1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +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
if (ListenSockets)
{
for (int i = 0; i < NumListenSockets; i++) for (int i = 0; i < NumListenSockets; i++)
StreamClose(ListenSockets[i]); StreamClose(ListenSockets[i]);
NumListenSockets = 0;
pfree(ListenSockets); pfree(ListenSockets);
}
NumListenSockets = 0;
ListenSockets = NULL; ListenSockets = NULL;
#endif #endif