projects
/
pgpool2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aefe34a
)
Fix to check the return value of malloc().
master
author
Tatsuo Ishii
<ishii@postgresql.org>
Wed, 7 Jan 2026 11:31:31 +0000
(20:31 +0900)
committer
Tatsuo Ishii
<ishii@postgresql.org>
Wed, 7 Jan 2026 11:31:31 +0000
(20:31 +0900)
create_inet_domain_sockets() forgot to check the return value of
malloc() while allocating memory for socket fds.
Backpatch-through: v4.3
src/main/pgpool_main.c
patch
|
blob
|
blame
|
history
diff --git
a/src/main/pgpool_main.c
b/src/main/pgpool_main.c
index 5e7832a8824649b85e9c8fab0d0964a1517b08c5..98fba4b2bbef719708eca230816646b5f7590136 100644
(file)
--- a/
src/main/pgpool_main.c
+++ b/
src/main/pgpool_main.c
@@
-982,6
+982,9
@@
create_inet_domain_sockets(const char *hostname, const int port)
n++;
sockfds = malloc(sizeof(int) * (n + 1));
+ if (sockfds == NULL)
+ ereport(FATAL,
+ (errmsg("failed to allocate memory for socket fds")));
n = 0;
for (walk = res; walk != NULL; walk = walk->ai_next)
sockfds[n++] = -1;