public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
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
Subject: PATCH: libiberty/make-relative-prefix.c, resource leak.
Date: Wed, 01 Aug 2007 01:18:00 -0000	[thread overview]
Message-ID: <4387.12.7.175.2.1185931095.squirrel@webmail.sonic.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: 302.txt --]
[-- Type: text/plain, Size: 1328 bytes --]

2007-07-31  Michael Snyder  <msnyder@access-company.com>

	* 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--;
  

             reply	other threads:[~2007-08-01  1:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-01  1:18 msnyder [this message]
2007-08-03 16:32 ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4387.12.7.175.2.1185931095.squirrel@webmail.sonic.net \
    --to=msnyder@sonic.net \
    --cc=binutils@sourceware.org \
    --cc=bje@ibm.com \
    --cc=dberlin@dberlin.org \
    --cc=dj@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=ian@airs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).