Commit 329de9fa authored by Heikki Linnakangas's avatar Heikki Linnakangas

Don't leak memory after connection aborts in pg_recvlogical.

Andres Freund, noticed by coverity.
parent c8345768
......@@ -547,9 +547,6 @@ StreamLog(void)
}
PQclear(res);
if (copybuf != NULL)
PQfreemem(copybuf);
if (outfd != -1 && strcmp(outfile, "-") != 0)
{
int64 t = feGetCurrentTimestamp();
......@@ -563,6 +560,11 @@ StreamLog(void)
}
outfd = -1;
error:
if (copybuf != NULL)
{
PQfreemem(copybuf);
copybuf = NULL;
}
destroyPQExpBuffer(query);
PQfinish(conn);
conn = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment