Fix a use-after-freed error introduced by previous attempt to fix a Coverity scan...
authorNick Clifton <nickc@redhat.com>
Thu, 13 Sep 2018 15:14:36 +0000 (16:14 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 13 Sep 2018 15:14:36 +0000 (16:14 +0100)
PR 23633
* objcopy.c (add_specific_symbols): Do not free the buffer at the
end of the function.

binutils/ChangeLog
binutils/objcopy.c

index d77b3ab188baada32d689d25b6b932d07beafecb..040e6ec2662140297a5ef5026043519ba7b1ebe5 100644 (file)
@@ -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
index f712ffe5917fbb6e39543052a02e82160783fc9a..8e06cd284f5a72dfed52ff73ff70b3457b326a86 100644 (file)
@@ -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