Skip to content

Commit 4ccac92

Browse files
committed
Fix double-free bug of WAL streaming buffer in pg_receivexlog.
This bug was introduced while refactoring in commit 74cbe96.
1 parent 74cbe96 commit 4ccac92

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/bin/pg_basebackup/receivelog.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,12 +1079,11 @@ CopyStreamPoll(PGconn *conn, long timeout_ms)
10791079
static int
10801080
CopyStreamReceive(PGconn *conn, long timeout, char **buffer)
10811081
{
1082-
static char *copybuf = NULL;
1082+
char *copybuf = NULL;
10831083
int rawlen;
10841084

1085-
if (copybuf != NULL)
1086-
PQfreemem(copybuf);
1087-
copybuf = NULL;
1085+
if (*buffer != NULL)
1086+
PQfreemem(*buffer);
10881087
*buffer = NULL;
10891088

10901089
/* Try to receive a CopyData message */

0 commit comments

Comments
 (0)