1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

Fix crash on syslogger startup

When syslogger starts up, ListenSockets is still NULL. Don't try to
pfree it. Oversight in commit e29c464395.

Reported-by: Michael Paquier
Discussion: https://www.postgresql.org/message-id/ZR-uNkgL7m60lWUe@paquier.xyz
This commit is contained in:
Heikki Linnakangas
2023-10-06 10:22:02 +03:00
parent fd4d93d269
commit 5da0a622e8

View File

@ -2565,10 +2565,13 @@ ClosePostmasterPorts(bool am_syslogger)
* EXEC_BACKEND mode. * EXEC_BACKEND mode.
*/ */
#ifndef EXEC_BACKEND #ifndef EXEC_BACKEND
for (int i = 0; i < NumListenSockets; i++) if (ListenSockets)
StreamClose(ListenSockets[i]); {
for (int i = 0; i < NumListenSockets; i++)
StreamClose(ListenSockets[i]);
pfree(ListenSockets);
}
NumListenSockets = 0; NumListenSockets = 0;
pfree(ListenSockets);
ListenSockets = NULL; ListenSockets = NULL;
#endif #endif