This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] objcopy: Close some memory leaks in error paths
- From: Andrew Burgess <aburgess at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 4 Nov 2016 22:26:45 -0000
- Subject: [binutils-gdb] objcopy: Close some memory leaks in error paths
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=848ac659685fba46ce8816400db705f60c8040f7
commit 848ac659685fba46ce8816400db705f60c8040f7
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Thu Aug 11 16:04:59 2016 +0100
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.
Diff:
---
binutils/ChangeLog | 5 +++++
binutils/objcopy.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f1e1f9b..09f76b9 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-04 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * objcopy.c (copy_section): Add extra calls to free for error
+ paths.
+
2016-11-04 Tom Tromey <tom@tromey.com>
* dwarf-mode.el (dwarf-browse): Set default-directory. Bump
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);