diff options
author | Nick Clifton <nickc@redhat.com> | 2011-03-25 17:17:03 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2011-03-25 17:17:03 +0000 |
commit | a1bc0327a3df4e35e5b923913536c31ca85f16dc (patch) | |
tree | 4853282d143e36bb351067218e81ea9c0942777d /binutils | |
parent | 6a6969108e510d407755889162afbe3107f2f3d8 (diff) | |
download | gdb-a1bc0327a3df4e35e5b923913536c31ca85f16dc.zip gdb-a1bc0327a3df4e35e5b923913536c31ca85f16dc.tar.gz gdb-a1bc0327a3df4e35e5b923913536c31ca85f16dc.tar.bz2 |
* ar.c (delete_members): Plug memory leak.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 1 | ||||
-rw-r--r-- | binutils/ar.c | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index d369ae8..ae56956 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -2,6 +2,7 @@ * strings.c (print_strings): Plug memory leak. * ar.c (move_members): Plug memory leak. + (delete_members): Plug memory leak. 2011-03-25 Pierre Muller <muller@ics.u-strasbg.fr> diff --git a/binutils/ar.c b/binutils/ar.c index 6320a28..263795f 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -1118,6 +1118,7 @@ delete_members (bfd *arch, char **files_to_delete) bfd_boolean found; bfd_boolean something_changed = FALSE; int match_count; + const char * tmp = NULL; for (; *files_to_delete != NULL; ++files_to_delete) { @@ -1139,8 +1140,10 @@ delete_members (bfd *arch, char **files_to_delete) current_ptr_ptr = &(arch->archive_next); while (*current_ptr_ptr) { - if (FILENAME_CMP (normalize (*files_to_delete, arch), - (*current_ptr_ptr)->filename) == 0) + if (tmp != NULL) + free ((char *) tmp); + tmp = normalize (*files_to_delete, arch); + if (FILENAME_CMP (tmp, (*current_ptr_ptr)->filename) == 0) { ++match_count; if (counted_name_mode @@ -1177,6 +1180,9 @@ delete_members (bfd *arch, char **files_to_delete) write_archive (arch); else output_filename = NULL; + + if (tmp != NULL) + free ((char *) tmp); } |