From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2206) id 9818E395C061; Tue, 3 Aug 2021 15:55:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9818E395C061 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Siddhesh Poyarekar To: glibc-cvs@sourceware.org Subject: [glibc] gaiconf_init: Avoid double-free in label and precedence lists X-Act-Checkin: glibc X-Git-Author: Siddhesh Poyarekar X-Git-Refname: refs/heads/master X-Git-Oldrev: 45caed9d67a00af917d8b5b88d4b5eb1225b7aef X-Git-Newrev: 77a34079d8f3d63b61543bf3af93043f8674e4c4 Message-Id: <20210803155541.9818E395C061@sourceware.org> Date: Tue, 3 Aug 2021 15:55:41 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 15:55:41 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=77a34079d8f3d63b61543bf3af93043f8674e4c4 commit 77a34079d8f3d63b61543bf3af93043f8674e4c4 Author: Siddhesh Poyarekar Date: Tue Aug 3 21:11:03 2021 +0530 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 Diff: --- sysdeps/posix/getaddrinfo.c | 2 ++ 1 file changed, 2 insertions(+) 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. */