Commit 505deda1 authored by louiz’'s avatar louiz’

Fix a memory leak when psql connection fails

parent 4a2a280d
......@@ -34,6 +34,7 @@ std::unique_ptr<DatabaseEngine> PostgresqlEngine::open(const std::string& connin
{
const char* errmsg = PQerrorMessage(con);
log_error("Postgresql connection failed: ", errmsg);
PQfinish(con);
throw std::runtime_error("failed to open connection.");
}
return std::make_unique<PostgresqlEngine>(con);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment