merge from gcc
authorDJ Delorie <dj@redhat.com>
Fri, 3 Aug 2007 19:49:44 +0000 (19:49 +0000)
committerDJ Delorie <dj@redhat.com>
Fri, 3 Aug 2007 19:49:44 +0000 (19:49 +0000)
libiberty/ChangeLog
libiberty/make-relative-prefix.c

index aee3cc76f575ae43235fc2f474c83a7b3624ea05..28e2c4fab3a3aef707f41e3a83b580f6d925fe94 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-03  Michael Snyder  <msnyder@access-company.com>
+
+       * make-relative-prefix.c (make_relative_prefix_1): Fix resource
+       leak.
+
 2007-07-31  Michael Snyder  <msnyder@access-company.com>
 
        * cp-demangle.c (d_print_comp): Guard against null.
index 037809e34edfabbf5288ece771676e227b64a098..be61040e18c7dfd9a9ec694764c14c90b46c1d07 100644 (file)
@@ -299,11 +299,17 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix,
     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)
+  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--;
 
This page took 0.034097 seconds and 4 git commands to generate.