projects
/
postgresql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c834576
)
Don't leak memory after connection aborts in pg_recvlogical.
author
Heikki Linnakangas
Mon, 5 May 2014 13:20:12 +0000
(16:20 +0300)
committer
Heikki Linnakangas
Mon, 5 May 2014 13:20:12 +0000
(16:20 +0300)
Andres Freund, noticed by coverity.
src/bin/pg_basebackup/pg_recvlogical.c
patch
|
blob
|
blame
|
history
diff --git
a/src/bin/pg_basebackup/pg_recvlogical.c
b/src/bin/pg_basebackup/pg_recvlogical.c
index 8141ba31f9d16ce9416de9e98ada4dc23fca8419..fe902cf9691b051de3b3a26cf31e70543c45aac7 100644
(file)
--- 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;