Content-Length: 278426 | pFad | http://github.com/postgrespro/postgres/commit/329de9fa983debc941ebd79f335f2574b72a3694

6E Don't leak memory after connection aborts in pg_recvlogical. · postgrespro/postgres@329de9f · GitHub
Skip to content

Commit 329de9f

Browse files
committed
Don't leak memory after connection aborts in pg_recvlogical.
Andres Freund, noticed by coverity.
1 parent c834576 commit 329de9f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/bin/pg_basebackup/pg_recvlogical.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,6 @@ StreamLog(void)
547547
}
548548
PQclear(res);
549549

550-
if (copybuf != NULL)
551-
PQfreemem(copybuf);
552-
553550
if (outfd != -1 && strcmp(outfile, "-") != 0)
554551
{
555552
int64 t = feGetCurrentTimestamp();
@@ -563,6 +560,11 @@ StreamLog(void)
563560
}
564561
outfd = -1;
565562
error:
563+
if (copybuf != NULL)
564+
{
565+
PQfreemem(copybuf);
566+
copybuf = NULL;
567+
}
566568
destroyPQExpBuffer(query);
567569
PQfinish(conn);
568570
conn = NULL;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/329de9fa983debc941ebd79f335f2574b72a3694

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy