diff --git a/src/main.cpp b/src/main.cpp index a02da25..8f2d3ad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -126,13 +126,17 @@ int main() { file.open(std::string("pastes/") + key, std::ios_base::out); if (!file.is_open()) { + free(key); return crow::response(crow::status::INTERNAL_SERVER_ERROR); } file << req.body; file.close(); - return crow::response(base_url + key); + std::string res = base_url + key; + free(key); + + return crow::response(res); }); app.port(18080).multithreaded().run();