summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Munro2023-03-16 20:44:42 +0000
committerThomas Munro2023-03-16 20:58:08 +0000
commit9d6c3439716f04e1dea92376e794ddde98624e3b (patch)
tree67274ea64d7cf00fa722a103df63b344a46bb1db
parent5ff8e69d8ea594075e435bb42e95b605e08afc2f (diff)
Small tidyup for commit d41a178b.
A comment was left behind claiming that we needed to use malloc() rather than palloc() because the corresponding free would run in another thread, but that's not true anymore. Remove that comment. And, with the reason being gone, we might as well actually use palloc(). Back-patch to supported releases, like d41a178b. Discussion: https://postgr.es/m/CA%2BhUKG%2BpdM9v3Jv4tc2BFx2jh_daY3uzUyAGBhtDkotEQDNPYw%40mail.gmail.com
-rw-r--r--src/backend/postmaster/postmaster.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 9b7fd073506..15e9b7c62ad 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -4741,14 +4741,11 @@ retry:
}
/*
- * Queue a waiter for to signal when this child dies. The wait will be
- * handled automatically by an operating system thread pool.
- *
- * Note: use malloc instead of palloc, since it needs to be thread-safe.
- * Struct will be free():d from the callback function that runs on a
- * different thread.
+ * Queue a waiter to signal when this child dies. The wait will be handled
+ * automatically by an operating system thread pool. The memory will be
+ * freed by a later call to waitpid().
*/
- childinfo = malloc(sizeof(win32_deadchild_waitinfo));
+ childinfo = palloc(sizeof(win32_deadchild_waitinfo));
if (!childinfo)
ereport(FATAL,
(errcode(ERRCODE_OUT_OF_MEMORY),
@@ -6519,7 +6516,7 @@ waitpid(pid_t pid, int *exitstatus, int options)
* Free struct that was allocated before the call to
* RegisterWaitForSingleObject()
*/
- free(childinfo);
+ pfree(childinfo);
return pid;
}