summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2023-10-06 07:22:02 +0000
committerHeikki Linnakangas2023-10-06 07:22:02 +0000
commit5da0a622e88907722ce456d30dbf0565ed7a222b (patch)
tree0257ee94425f92f44388501a9a8192dc19eb92c1
parentfd4d93d269c02081958e4c0c214f1d82186e5689 (diff)
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/[email protected]
-rw-r--r--src/backend/postmaster/postmaster.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 0d876c61fd..bc3c992a3a 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