aboutsummaryrefslogtreecommitdiff
path: root/libiberty/make-relative-prefix.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2007-08-03 19:49:44 +0000
committerDJ Delorie <dj@redhat.com>2007-08-03 19:49:44 +0000
commit9250f7f0d29e4d4a5d40b2c77daa78d9438d7ead (patch)
treed6970f8a9bec73381088c58564b0e7b3fe123cc6 /libiberty/make-relative-prefix.c
parentb8deab3780678d3d2113fdc360462899a476be7d (diff)
downloadgdb-9250f7f0d29e4d4a5d40b2c77daa78d9438d7ead.zip
gdb-9250f7f0d29e4d4a5d40b2c77daa78d9438d7ead.tar.gz
gdb-9250f7f0d29e4d4a5d40b2c77daa78d9438d7ead.tar.bz2
merge from gcc
Diffstat (limited to 'libiberty/make-relative-prefix.c')
-rw-r--r--libiberty/make-relative-prefix.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c
index 037809e..be61040 100644
--- a/libiberty/make-relative-prefix.c
+++ b/libiberty/make-relative-prefix.c
@@ -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--;