summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorAlvaro Herrera2006-05-28 17:23:29 +0000
committerAlvaro Herrera2006-05-28 17:23:29 +0000
commit117d73a9e7af61f6742e3d2b46f1dfbe3e02b9ca (patch)
treef2a5179957d63d898ade09424c91e51f273f9fa7 /src/bin
parent7a6676d9df6e89d6ecdfacd8b377a881dc0e237d (diff)
Don't call PQclear until the struct is really no longer going to be used.
Per Coverity bug #304. Thanks to Martijn van Oosterhout for reporting it. Zero out the pointer fields of PGresult so that these mistakes are more easily catched, per discussion.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/pg_dump/pg_dump.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 950d47a44cb..a32af2846ac 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.434 2006/05/26 23:48:54 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.435 2006/05/28 17:23:29 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1445,8 +1445,6 @@ dumpStdStrings(Archive *AH)
check_sql_result(res, g_conn, qry->data, PGRES_TUPLES_OK);
- PQclear(res);
-
resetPQExpBuffer(qry);
std_strings = (strcmp(PQgetvalue(res, 0, 0), "on") == 0);
@@ -1454,7 +1452,8 @@ dumpStdStrings(Archive *AH)
appendStringLiteral(qry, PQgetvalue(res, 0, 0), true, !std_strings);
appendPQExpBuffer(qry, ";\n");
puts(PQgetvalue(res, 0, 0));
-
+
+ PQclear(res);
}
ArchiveEntry(AH, nilCatalogId, createDumpId(),