mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Avoid minor leak in parallel pg_dump
During parallel pg_dump, a worker process closing the connection caused a minor memory leak (particularly minor as we are likely about to exit anyway). Instead, free the memory in this case prior to returning NULL to indicate connection closed. Spotting by the Coverity scanner. Back patch to 9.3 where this was introduced.
This commit is contained in:
parent
d150ff5781
commit
6794a9f9a1
@ -1288,7 +1288,7 @@ readMessageFromPipe(int fd)
|
||||
|
||||
/* worker has closed the connection or another error happened */
|
||||
if (ret <= 0)
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
Assert(ret == 1);
|
||||
|
||||
@ -1303,6 +1303,14 @@ readMessageFromPipe(int fd)
|
||||
msg = (char *) realloc(msg, bufsize);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Worker has closed the connection, make sure to clean up before return
|
||||
* since we are not returning msg (but did allocate it).
|
||||
*/
|
||||
free(msg);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user