From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2206) id 2823B395C824; Tue, 3 Aug 2021 15:55:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2823B395C824 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] ldconfig: avoid leak on empty paths in config file X-Act-Checkin: glibc X-Git-Author: Siddhesh Poyarekar X-Git-Refname: refs/heads/master X-Git-Oldrev: 2ee9b24f47db8d0a8d0ccadb999335a1d4cfc364 X-Git-Newrev: b0234d79e7d82475d1666f25326ec045c045b3ed Message-Id: <20210803155521.2823B395C824@sourceware.org> Date: Tue, 3 Aug 2021 15:55:21 +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:21 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b0234d79e7d82475d1666f25326ec045c045b3ed commit b0234d79e7d82475d1666f25326ec045c045b3ed Author: Siddhesh Poyarekar Date: Tue Aug 3 21:10:10 2021 +0530 ldconfig: avoid leak on empty paths in config file Reviewed-by: Arjun Shankar Diff: --- elf/ldconfig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 1037e8d0cf..b8893637f8 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -503,7 +503,11 @@ add_dir_1 (const char *line, const char *from_file, int from_line) entry->path[--i] = '\0'; if (i == 0) - return; + { + free (entry->path); + free (entry); + return; + } char *path = entry->path; if (opt_chroot != NULL)