summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2018-09-13 16:14:36 +0100
committerNick Clifton <nickc@redhat.com>2018-09-13 16:14:36 +0100
commit508d0c9b5945d30bcf163b9b88213d277949e9a8 (patch)
tree89b1eeab83b6978cd84e9df13959a59b8d05c428
parent5be12fc1ad9e47e82bd8902ad6a1f71946c58805 (diff)
downloadbinutils-gdb-508d0c9b5945d30bcf163b9b88213d277949e9a8.tar.gz
Fix a use-after-freed error introduced by previous attempt to fix a Coverity scan result.
PR 23633 * objcopy.c (add_specific_symbols): Do not free the buffer at the end of the function.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objcopy.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index d77b3ab188b..040e6ec2662 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2018-09-13 Nick Clifton <nickc@redhat.com>
+
+ PR 23633
+ * objcopy.c (add_specific_symbols): Do not free the buffer at the
+ end of the function.
+
2018-09-10 Alan Modra <amodra@gmail.com>
PR binutils/23611
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index f712ffe5917..8e06cd284f5 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1143,7 +1143,8 @@ add_specific_symbols (const char *filename, htab_t htab)
line_count ++;
}
- free (buffer);
+ /* Do not free the buffer. Parts of it will have been referenced
+ in the calls to add_specific_symbol. */
}
/* See whether a symbol should be stripped or kept