pgpool2.git / summary / log / commit / refs

commit    93a67fe9c46599ffce08596e357a711e5a8660de
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Wed Jan 07 11:31:31 2026 +0000

    Fix to check the return value of malloc().
    
    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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index 5e7832a88..98fba4b2b 100644 --- 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; [parent: aefe34a3f4d8]