Re-fix leak in source.c (open_source_file).
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 24 Nov 2018 11:42:24 +0000 (12:42 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 24 Nov 2018 11:42:24 +0000 (12:42 +0100)
Leak fixed in '8e6a5953e1d Fix 4K leak in open_source_file' has been partially
undone by '2179fbc36d23 Return scoped_fd from open_source_file'. Re-add the
transfer of current s->fullname to the unique_xmalloc_ptr fullname given to
find_and_open_source.

gdb/ChangeLog
gdb/source.c

index 90e8d7a5c6a529bffe64cc654ccce149746c870f..2515a4d0b845c35cb0ce586df5769f58ecc448a3 100644 (file)
@@ -1,3 +1,11 @@
+2018-11-24  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+       * source.c (open_source_file): Leak fixed in '8e6a5953e1d Fix 4K
+       leak in open_source_file' has been partially undone by '2179fbc36d23
+       Return scoped_fd from open_source_file'. Re-add the transfer of
+       current s->fullname to the unique_xmalloc_ptr fullname given
+       to find_and_open_source.
+
 2018-11-23  Pedro Alves  <palves@redhat.com>
 
        * gdbthread.h (enum thread_state): Move comments here.
index b38eed5be687c9df5788e8d650127d09903a3158..e295fbf49e39e2ec03fe04f817947e66d00e2f04 100644 (file)
@@ -1068,7 +1068,7 @@ open_source_file (struct symtab *s)
   if (!s)
     return scoped_fd (-1);
 
-  gdb::unique_xmalloc_ptr<char> fullname;
+  gdb::unique_xmalloc_ptr<char> fullname (s->fullname);
   s->fullname = NULL;
   scoped_fd fd = find_and_open_source (s->filename, SYMTAB_DIRNAME (s),
                                       &fullname);