Skip to content

Commit c890b48

Browse files
committed
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.
1 parent e6df2e1 commit c890b48

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/bin/pg_basebackup/receivelog.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
858858
if (!close_walfile(basedir, partial_suffix, blockpos))
859859
{
860860
/* Error message written in close_walfile() */
861+
PQclear(res);
861862
goto error;
862863
}
863864
if (PQresultStatus(res) == PGRES_COPY_IN)
@@ -867,6 +868,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
867868
fprintf(stderr,
868869
_("%s: could not send copy-end packet: %s"),
869870
progname, PQerrorMessage(conn));
871+
PQclear(res);
870872
goto error;
871873
}
872874
res = PQgetResult(conn);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy