Skip to content
Snippets Groups Projects
Commit c890b488 authored by Heikki Linnakangas's avatar Heikki Linnakangas
Browse files

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.
parent e6df2e1b
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment