diff options
author | Michael Snyder <msnyder@access-company.com> | 2007-08-03 17:38:14 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2007-08-03 17:38:14 +0000 |
commit | fd83e387113ddd0dbd4c31d235114f4c2c308a07 (patch) | |
tree | c08be4735100482d4b109156e67c84652bd4a1c6 /libiberty/make-relative-prefix.c | |
parent | 7475160c8db55a1893abbfcdb9c926a5c0370c41 (diff) | |
download | gcc-fd83e387113ddd0dbd4c31d235114f4c2c308a07.zip gcc-fd83e387113ddd0dbd4c31d235114f4c2c308a07.tar.gz gcc-fd83e387113ddd0dbd4c31d235114f4c2c308a07.tar.bz2 |
make-relative-prefix.c (make_relative_prefix_1): Fix resource leak.
* make-relative-prefix.c (make_relative_prefix_1): Fix resource
leak.
From-SVN: r127183
Diffstat (limited to 'libiberty/make-relative-prefix.c')
-rw-r--r-- | libiberty/make-relative-prefix.c | 10 |
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--; |