about summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2021-08-03 21:11:03 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2021-08-03 21:11:03 +0530
commit77a34079d8f3d63b61543bf3af93043f8674e4c4 (patch)
treece95a4a22aada0b845e6c196b08ccba2c70ec5a7 /sysdeps/posix
parent45caed9d67a00af917d8b5b88d4b5eb1225b7aef (diff)
downloadglibc-77a34079d8f3d63b61543bf3af93043f8674e4c4.tar.gz
glibc-77a34079d8f3d63b61543bf3af93043f8674e4c4.tar.xz
glibc-77a34079d8f3d63b61543bf3af93043f8674e4c4.zip
gaiconf_init: Avoid double-free in label and precedence lists
labellist and precedencelist could get freed a second time if there
are allocation failures, so set them to NULL to avoid a double-free.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 838a68f022..43dfc6739e 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2008,6 +2008,7 @@ gaiconf_init (void)
 	      l = l->next;
 	    }
 	  free_prefixlist (labellist);
+	  labellist = NULL;
 
 	  /* Sort the entries so that the most specific ones are at
 	     the beginning.  */
@@ -2046,6 +2047,7 @@ gaiconf_init (void)
 	      l = l->next;
 	    }
 	  free_prefixlist (precedencelist);
+	  precedencelist = NULL;
 
 	  /* Sort the entries so that the most specific ones are at
 	     the beginning.  */