aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/pg_basebackup/pg_recvlogical.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c
index 8141ba31f9d..fe902cf9691 100644
--- a/src/bin/pg_basebackup/pg_recvlogical.c
+++ b/src/bin/pg_basebackup/pg_recvlogical.c
@@ -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;