From: Kern Sibbald Date: Tue, 29 May 2007 12:42:31 +0000 (+0000) Subject: Fix PostgreSQL double free. X-Git-Tag: Release-7.0.0~6216 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=93a62b50cec8784d7312d6356c33020478f77864;p=bacula%2Fbacula Fix PostgreSQL double free. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4929 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index a96ac4a095..9886faac0a 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -445,8 +445,9 @@ int my_postgresql_query(B_DB *mdb, const char *query) { mdb->row_number = -1; mdb->field_number = -1; - if (mdb->result != NULL) { + if (mdb->result) { PQclear(mdb->result); /* hmm, someone forgot to free?? */ + mdb->result = NULL; } Dmsg1(500, "my_postgresql_query starts with '%s'\n", query); @@ -459,7 +460,7 @@ int my_postgresql_query(B_DB *mdb, const char *query) { mdb->num_fields = (int) PQnfields(mdb->result); Dmsg1(500, "we have %d fields\n", mdb->num_fields); - mdb->num_rows = PQntuples(mdb->result); + mdb->num_rows = PQntuples(mdb->result); Dmsg1(500, "we have %d rows\n", mdb->num_rows); mdb->status = 0;