aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-11-15 22:23:22 +1030
committerAlan Modra <amodra@gmail.com>2017-11-15 22:30:27 +1030
commitbe74fad95edc8827516e144cf38d135b503249cd (patch)
tree1a4f6911ac2ab12e527a6f759e29d61613d4f630 /binutils
parenta5065160868895e91cac8515263d9783f8120818 (diff)
downloadgdb-be74fad95edc8827516e144cf38d135b503249cd.zip
gdb-be74fad95edc8827516e144cf38d135b503249cd.tar.gz
gdb-be74fad95edc8827516e144cf38d135b503249cd.tar.bz2
objcopy memory leak
PR 22426 * objcopy.c (copy_main): Free tmpname.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/objcopy.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3f20d7f..a469e37 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-15 Alan Modra <amodra@gmail.com>
+
+ PR 22426
+ * objcopy.c (copy_main): Free tmpname.
+
2017-11-15 Nick Clifton <nickc@redhat.com>
PR 15152
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index e5df1a9..c45133b 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -5301,6 +5301,9 @@ copy_main (int argc, char *argv[])
else
unlink_if_ordinary (tmpname);
+ if (tmpname != output_filename)
+ free (tmpname);
+
if (change_warn)
{
struct section_list *p;