Fix leak in solib-target.c:library_list_start_library
authorPedro Alves <palves@redhat.com>
Thu, 10 Jan 2019 17:52:39 +0000 (17:52 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 10 Jan 2019 18:03:41 +0000 (18:03 +0000)
lm_info_target::name is nowadays std::string, so we're leaking the
result of xstrdup.

gdb/ChangeLog:
2019-01-10  Pedro Alves  <palves@redhat.com>

* solib-target.c (library_list_start_library): Don't xstrdup name.

gdb/ChangeLog
gdb/solib-target.c

index b651980a3f09c11a885d3a55b315aaf31bd47e47..1c036bb91fdb83a89db630766bfa92d60bbc29d4 100644 (file)
@@ -1,3 +1,7 @@
+2019-01-10  Pedro Alves  <palves@redhat.com>
+
+       * solib-target.c (library_list_start_library): Don't xstrdup name.
+
 2019-01-10  Pedro Alves  <palves@redhat.com>
 
        * mdebugread.c (parse_partial_symbols): Use
index 17b958eb2335423d9debf08335c3bfdc05c83150..972d9ef17b30359c4df3887b37f46657351c8fe9 100644 (file)
@@ -124,10 +124,9 @@ library_list_start_library (struct gdb_xml_parser *parser,
 {
   VEC(lm_info_target_p) **list = (VEC(lm_info_target_p) **) user_data;
   lm_info_target *item = new lm_info_target;
-  const char *name
+  item->name
     = (const char *) xml_find_attribute (attributes, "name")->value.get ();
 
-  item->name = xstrdup (name);
   VEC_safe_push (lm_info_target_p, *list, item);
 }