postgres.git / summary / log / commit / refs

commit    5da0a622e88907722ce456d30dbf0565ed7a222b
Author:   Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:     Fri Oct 06 07:22:02 2023 +0000
First released in: 17.0

    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


src/backend/postmaster/postmaster.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 0d876c61fd7..bc3c992a3a3 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -2565,10 +2565,13 @@ ClosePostmasterPorts(bool am_syslogger) * EXEC_BACKEND mode. */ #ifndef EXEC_BACKEND - for (int i = 0; i < NumListenSockets; i++) - StreamClose(ListenSockets[i]); + if (ListenSockets) + { + for (int i = 0; i < NumListenSockets; i++) + StreamClose(ListenSockets[i]); + pfree(ListenSockets); + } NumListenSockets = 0; - pfree(ListenSockets); ListenSockets = NULL; #endif [parent: fd4d93d269c0]