From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27572 invoked by alias); 1 Aug 2007 01:18:22 -0000 Received: (qmail 27564 invoked by uid 22791); 1 Aug 2007 01:18:21 -0000 X-Spam-Check-By: sourceware.org Received: from a.mail.sonic.net (HELO a.mail.sonic.net) (64.142.16.245) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Aug 2007 01:18:18 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l711IF7Q029842; Tue, 31 Jul 2007 18:18:15 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Tue, 31 Jul 2007 18:18:15 -0700 (PDT) Message-ID: <4387.12.7.175.2.1185931095.squirrel@webmail.sonic.net> Date: Wed, 01 Aug 2007 01:18:00 -0000 Subject: PATCH: libiberty/make-relative-prefix.c, resource leak. From: msnyder@sonic.net To: gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org, binutils@sourceware.org Cc: ian@airs.com, bje@ibm.com, dj@redhat.com, dberlin@dberlin.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070731181815_15709" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-08/txt/msg00001.txt.bz2 ------=_20070731181815_15709 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 0 ------=_20070731181815_15709 Content-Type: text/plain; name="302.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="302.txt" Content-length: 1328 2007-07-31 Michael Snyder * make-relative-prefix.c (make_relative_prefix_1): Resource leak. Index: make-relative-prefix.c =================================================================== RCS file: /cvs/src/src/libiberty/make-relative-prefix.c,v retrieving revision 1.9 diff -p -r1.9 make-relative-prefix.c *** make-relative-prefix.c 11 Apr 2007 20:01:26 -0000 1.9 --- make-relative-prefix.c 1 Aug 2007 01:13:35 -0000 *************** make_relative_prefix_1 (const char *prog *** 299,309 **** full_progname = strdup(progname); prog_dirs = split_directories (full_progname, &prog_num); - bin_dirs = split_directories (bin_prefix, &bin_num); free (full_progname); ! if (bin_dirs == NULL || prog_dirs == NULL) return NULL; /* Remove the program name from comparison of directory names. */ prog_num--; --- 299,315 ---- full_progname = strdup(progname); prog_dirs = split_directories (full_progname, &prog_num); free (full_progname); ! if (prog_dirs == NULL) return NULL; + bin_dirs = split_directories (bin_prefix, &bin_num); + if (bin_dirs == NULL) + { + free_split_directories (prog_dirs); + return NULL; + } + /* Remove the program name from comparison of directory names. */ prog_num--; ------=_20070731181815_15709--