Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/net CVE 1020938: Fix memory leak



details:   https://anonhg.NetBSD.org/src/rev/6f25a28a8ab4
branches:  trunk
changeset: 786812:6f25a28a8ab4
user:      christos <christos%NetBSD.org@localhost>
date:      Mon May 13 13:59:39 2013 +0000

description:
CVE 1020938: Fix memory leak

diffstat:

 lib/libc/net/getaddrinfo.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r ee3bd569b5fc -r 6f25a28a8ab4 lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Mon May 13 12:07:44 2013 +0000
+++ b/lib/libc/net/getaddrinfo.c        Mon May 13 13:59:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getaddrinfo.c,v 1.103 2013/05/03 19:31:13 christos Exp $       */
+/*     $NetBSD: getaddrinfo.c,v 1.104 2013/05/13 13:59:39 christos Exp $       */
 /*     $KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $    */
 
 /*
@@ -55,7 +55,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.103 2013/05/03 19:31:13 christos Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.104 2013/05/13 13:59:39 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -1405,6 +1405,11 @@
                }
                res = __res_get_state();
                if (res == NULL) {
+                       while (srvlist != NULL) {
+                               srv = srvlist;
+                               srvlist = srvlist->next;
+                               free(srv);
+                       }
                        h_errno = NETDB_INTERNAL;
                        return NULL;
                }



Home | Main Index | Thread Index | Old Index