mirror of
https://github.com/postgres/postgres.git
synced 2025-06-04 00:02:37 -04:00
Don't leak memory after connection aborts in pg_recvlogical.
Andres Freund, noticed by coverity.
This commit is contained in:
parent
c834576839
commit
329de9fa98
@ -547,9 +547,6 @@ StreamLog(void)
|
|||||||
}
|
}
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|
||||||
if (copybuf != NULL)
|
|
||||||
PQfreemem(copybuf);
|
|
||||||
|
|
||||||
if (outfd != -1 && strcmp(outfile, "-") != 0)
|
if (outfd != -1 && strcmp(outfile, "-") != 0)
|
||||||
{
|
{
|
||||||
int64 t = feGetCurrentTimestamp();
|
int64 t = feGetCurrentTimestamp();
|
||||||
@ -563,6 +560,11 @@ StreamLog(void)
|
|||||||
}
|
}
|
||||||
outfd = -1;
|
outfd = -1;
|
||||||
error:
|
error:
|
||||||
|
if (copybuf != NULL)
|
||||||
|
{
|
||||||
|
PQfreemem(copybuf);
|
||||||
|
copybuf = NULL;
|
||||||
|
}
|
||||||
destroyPQExpBuffer(query);
|
destroyPQExpBuffer(query);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user