aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2016-08-11 16:04:59 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2016-11-04 22:13:06 +0000
commit848ac659685fba46ce8816400db705f60c8040f7 (patch)
tree77ddadb777db7938f2e69a567a6baac396dc0914 /binutils/objcopy.c
parentc42608e136ef1eb52f65002d5e7efe6d62b7f285 (diff)
downloadgdb-848ac659685fba46ce8816400db705f60c8040f7.zip
gdb-848ac659685fba46ce8816400db705f60c8040f7.tar.gz
gdb-848ac659685fba46ce8816400db705f60c8040f7.tar.bz2
objcopy: Close some memory leaks in error paths
Closes some memory leaks within objcopy for error paths. binutils/ChangeLog: * objcopy.c (copy_section): Add extra calls to free for error paths.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 1821c0c..d40cfcb 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3375,6 +3375,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
{
status = 1;
bfd_nonfatal_message (NULL, ibfd, isection, NULL);
+ free (memhunk);
return;
}
@@ -3428,6 +3429,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
{
status = 1;
bfd_nonfatal_message (NULL, obfd, osection, NULL);
+ free (memhunk);
return;
}
free (memhunk);
@@ -3449,6 +3451,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
{
status = 1;
bfd_nonfatal_message (NULL, obfd, osection, NULL);
+ free (memhunk);
return;
}
free (memhunk);