This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Re-fix leak in source.c (open_source_file).
- From: Philippe Waroquiers <philippe at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 24 Nov 2018 11:48:31 -0000
- Subject: [binutils-gdb] Re-fix leak in source.c (open_source_file).
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5446094655df842abb4ababac39f34c6342e8da3
commit 5446094655df842abb4ababac39f34c6342e8da3
Author: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Date: Sat Nov 24 12:42:24 2018 +0100
Re-fix leak in 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.
Diff:
---
gdb/ChangeLog | 8 ++++++++
gdb/source.c | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 90e8d7a..2515a4d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/source.c b/gdb/source.c
index b38eed5..e295fbf 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -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);