diff options
author | louiz’ <louiz@louiz.org> | 2018-02-14 23:25:12 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-02-14 23:25:12 +0100 |
commit | 505deda1763137fd807e16586c8a2e1aa978c647 (patch) | |
tree | a285d3bb481aec8bd86255c6638b0fe4980cd717 | |
parent | 4a2a280d76e45e165d5c4657f4a46eebf71594bf (diff) | |
download | biboumi-505deda1763137fd807e16586c8a2e1aa978c647.tar.gz biboumi-505deda1763137fd807e16586c8a2e1aa978c647.tar.bz2 biboumi-505deda1763137fd807e16586c8a2e1aa978c647.tar.xz biboumi-505deda1763137fd807e16586c8a2e1aa978c647.zip |
Fix a memory leak when psql connection fails
-rw-r--r-- | src/database/postgresql_engine.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/database/postgresql_engine.cpp b/src/database/postgresql_engine.cpp index 984a959..518c23a 100644 --- a/src/database/postgresql_engine.cpp +++ b/src/database/postgresql_engine.cpp @@ -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); |