From 505deda1763137fd807e16586c8a2e1aa978c647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 14 Feb 2018 23:25:12 +0100 Subject: Fix a memory leak when psql connection fails --- src/database/postgresql_engine.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/database') 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 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(con); -- cgit v1.2.3