diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-05-12 10:17:40 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-05-12 10:59:08 +0300 |
commit | 0ad78306be6bd3db0575b0d046e4cbe7f50635b8 (patch) | |
tree | 096987b2c0d9d570b1fea6a68262eeb47f51f9a1 | |
parent | c6d048c97864daa1a5011c5b11484e7d426139ba (diff) | |
download | postgresql-0ad78306be6bd3db0575b0d046e4cbe7f50635b8.tar.gz postgresql-0ad78306be6bd3db0575b0d046e4cbe7f50635b8.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.
-rw-r--r-- | src/bin/pg_basebackup/receivelog.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c index aca1a9e8b1a..ded9b70dc21 100644 --- a/src/bin/pg_basebackup/receivelog.c +++ b/src/bin/pg_basebackup/receivelog.c @@ -912,6 +912,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, if (!close_walfile(basedir, partial_suffix)) { /* Error message written in close_walfile() */ + PQclear(res); goto error; } if (PQresultStatus(res) == PGRES_COPY_IN) @@ -921,6 +922,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); |