Skip to content

Commit 32f9d56

Browse files
hlinnakapull[bot]
authored andcommitted
Fix crash on syslogger startup
When syslogger starts up, ListenSockets is still NULL. Don't try to pfree it. Oversight in commit e29c464. Reported-by: Michael Paquier Discussion: https://www.postgresql.org/message-id/ZR-uNkgL7m60lWUe@paquier.xyz
1 parent cc015dd commit 32f9d56

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,10 +2565,13 @@ ClosePostmasterPorts(bool am_syslogger)
25652565
* EXEC_BACKEND mode.
25662566
*/
25672567
#ifndef EXEC_BACKEND
2568-
for (int i = 0; i < NumListenSockets; i++)
2569-
StreamClose(ListenSockets[i]);
2568+
if (ListenSockets)
2569+
{
2570+
for (int i = 0; i < NumListenSockets; i++)
2571+
StreamClose(ListenSockets[i]);
2572+
pfree(ListenSockets);
2573+
}
25702574
NumListenSockets = 0;
2571-
pfree(ListenSockets);
25722575
ListenSockets = NULL;
25732576
#endif
25742577

0 commit comments

Comments
 (0)