aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2023-10-06 10:22:02 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2023-10-06 10:22:02 +0300
commit5da0a622e88907722ce456d30dbf0565ed7a222b (patch)
tree0257ee94425f92f44388501a9a8192dc19eb92c1 /src
parentfd4d93d269c02081958e4c0c214f1d82186e5689 (diff)
downloadpostgresql-5da0a622e88907722ce456d30dbf0565ed7a222b.tar.gz
postgresql-5da0a622e88907722ce456d30dbf0565ed7a222b.zip
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
Diffstat (limited to 'src')
-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 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