From be74fad95edc8827516e144cf38d135b503249cd Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 15 Nov 2017 22:23:22 +1030 Subject: [PATCH] objcopy memory leak PR 22426 * objcopy.c (copy_main): Free tmpname. --- binutils/ChangeLog | 5 +++++ binutils/objcopy.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 3f20d7f129d..a469e37c827 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2017-11-15 Alan Modra + + PR 22426 + * objcopy.c (copy_main): Free tmpname. + 2017-11-15 Nick Clifton PR 15152 diff --git a/binutils/objcopy.c b/binutils/objcopy.c index e5df1a91956..c45133b41bb 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; -- 2.30.2