]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
gaiconf_init: Avoid double-free in label and precedence lists
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 3 Aug 2021 15:41:03 +0000 (21:11 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Wed, 4 Aug 2021 10:23:46 +0000 (15:53 +0530)
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>
(cherry picked from commit 77a34079d8f3d63b61543bf3af93043f8674e4c4)

sysdeps/posix/getaddrinfo.c

index 838a68f0229b5aa8b95d85ca001c20aac9a0dd0c..43dfc6739e350a584f2dd4f48ef5167edb1a0fab 100644 (file)
@@ -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.  */