]> granicus.if.org Git - icinga2/commitdiff
Fix memory leak in the db_ido_pgsql module
authorIldar Hizbulin <hizel@vyborg.ru>
Fri, 12 Sep 2014 15:51:59 +0000 (19:51 +0400)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 15 Sep 2014 12:22:10 +0000 (14:22 +0200)
fixes #7195

Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
components/db_ido_pgsql/idopgsqlconnection.cpp

index 6c76071fca0a3a7e43ba907900d05fe3254d1d81..045c4f3ccded9417238e46e6dc6270efcd911574 100644 (file)
@@ -371,8 +371,10 @@ IdoPgsqlResult IdoPgsqlConnection::Query(const String& query)
        char *rowCount = PQcmdTuples(result);
        m_AffectedRows = atoi(rowCount);
 
-       if (PQresultStatus(result) == PGRES_COMMAND_OK)
+       if (PQresultStatus(result) == PGRES_COMMAND_OK) {
+               PQclear(result);
                return IdoPgsqlResult();
+       }
 
        if (PQresultStatus(result) != PGRES_TUPLES_OK) {
                String message = PQresultErrorMessage(result);