aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-05-12 10:17:40 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-05-12 11:01:26 +0300
commitc890b488063e23f12b5ab01c9a6d254a034fcea2 (patch)
tree0b253ab1c7c0f2c4c9a2fe1b1c7c5695e2dbfa49 /src
parente6df2e1be6330660ba4d81daa726ae4a71535aa9 (diff)
downloadpostgresql-c890b488063e23f12b5ab01c9a6d254a034fcea2.tar.gz
postgresql-c890b488063e23f12b5ab01c9a6d254a034fcea2.zip
Free PQresult on error in pg_receivexlog.
The leak is fairly small and rare, but a leak nevertheless. Per Coverity report. Backpatch to 9.2, where pg_receivexlog was added. pg_basebackup shares the code, but it always exits on error, so there is no real leak.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/receivelog.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c
index ca5c7f55bdf..a88457fb288 100644
--- a/src/bin/pg_basebackup/receivelog.c
+++ b/src/bin/pg_basebackup/receivelog.c
@@ -858,6 +858,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
if (!close_walfile(basedir, partial_suffix, blockpos))
{
/* Error message written in close_walfile() */
+ PQclear(res);
goto error;
}
if (PQresultStatus(res) == PGRES_COPY_IN)
@@ -867,6 +868,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
fprintf(stderr,
_("%s: could not send copy-end packet: %s"),
progname, PQerrorMessage(conn));
+ PQclear(res);
goto error;
}
res = PQgetResult(conn);