Don't leak memory after connection aborts in pg_recvlogical.

Andres Freund, noticed by coverity.
This commit is contained in:
Heikki Linnakangas 2014-05-05 16:20:12 +03:00
parent c834576839
commit 329de9fa98
1 changed files with 5 additions and 3 deletions

View File

@ -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;