1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

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.
This commit is contained in:
Heikki Linnakangas
2014-05-12 10:17:40 +03:00
parent c6d048c978
commit 0ad78306be

View File

@ -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);