fix: free key when adding paste
ci/woodpecker/push/woodpecker Pipeline was successful Details

trie-skips
Jef Roosens 2022-11-21 19:48:01 +01:00
parent 425695596b
commit 91bba2e9ff
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 5 additions and 1 deletions

View File

@ -126,13 +126,17 @@ int main() {
file.open(std::string("pastes/") + key, std::ios_base::out); file.open(std::string("pastes/") + key, std::ios_base::out);
if (!file.is_open()) { if (!file.is_open()) {
free(key);
return crow::response(crow::status::INTERNAL_SERVER_ERROR); return crow::response(crow::status::INTERNAL_SERVER_ERROR);
} }
file << req.body; file << req.body;
file.close(); 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(); app.port(18080).multithreaded().run();