From 3154bfb8c7fb84fbf7ecdc787752b395579d2ac7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 13 Jun 2011 08:31:50 -0400 Subject: [PATCH] Fix memory leak in getaddrinfo --- ChangeLog | 5 +++++ sysdeps/posix/getaddrinfo.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 604619f..50a35a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-06-10 Andreas Schwab + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Fix logic allocating + tmpbuf. + 2011-06-10 Roland McGrath * Makerules (shlib.lds): Fail if the linker script comes out empty. diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 1e017b2..469abe2 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -821,7 +821,7 @@ gaih_inet (const char *name, const struct gaih_service *service, size_t tmpbuflen = 1024; malloc_tmpbuf = !__libc_use_alloca (alloca_used + tmpbuflen); assert (tmpbuf == NULL); - if (malloc_tmpbuf) + if (!malloc_tmpbuf) tmpbuf = alloca_account (tmpbuflen, alloca_used); else { -- 2.7.4