Skip to content

Commit 0ad7830

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 c6d048c commit 0ad7830

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
@@ -912,6 +912,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
912912
if (!close_walfile(basedir, partial_suffix))
913913
{
914914
/* Error message written in close_walfile() */
915+
PQclear(res);
915916
goto error;
916917
}
917918
if (PQresultStatus(res) == PGRES_COPY_IN)
@@ -921,6 +922,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
921922
fprintf(stderr,
922923
_("%s: could not send copy-end packet: %s"),
923924
progname, PQerrorMessage(conn));
925+
PQclear(res);
924926
goto error;
925927
}
926928
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