summaryrefslogtreecommitdiff
path: root/src/database
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-02-14 23:25:12 +0100
committerlouiz’ <louiz@louiz.org>2018-02-14 23:25:12 +0100
commit505deda1763137fd807e16586c8a2e1aa978c647 (patch)
treea285d3bb481aec8bd86255c6638b0fe4980cd717 /src/database
parent4a2a280d76e45e165d5c4657f4a46eebf71594bf (diff)
downloadbiboumi-505deda1763137fd807e16586c8a2e1aa978c647.tar.gz
biboumi-505deda1763137fd807e16586c8a2e1aa978c647.tar.bz2
biboumi-505deda1763137fd807e16586c8a2e1aa978c647.tar.xz
biboumi-505deda1763137fd807e16586c8a2e1aa978c647.zip
Fix a memory leak when psql connection fails
Diffstat (limited to 'src/database')
-rw-r--r--src/database/postgresql_engine.cpp1
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);