This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] completer.c (completion_list_add_name): Fix memory leak.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=013d031916a1f154054c3b2ccc2d35fa9ff5e397

commit 013d031916a1f154054c3b2ccc2d35fa9ff5e397
Author: Doug Evans <dje@google.com>
Date:   Thu Feb 12 13:32:36 2015 -0800

    completer.c (completion_list_add_name): Fix memory leak.
    
    gdb/ChangeLog:
    
    	* completer.c (completion_list_add_name): Fix memory leak.

Diff:
---
 gdb/ChangeLog | 4 ++++
 gdb/symtab.c  | 1 +
 2 files changed, 5 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a680f24..175328a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2015-02-12  Doug Evans  <dje@google.com>
 
+	* completer.c (completion_list_add_name): Fix memory leak.
+
+2015-02-12  Doug Evans  <dje@google.com>
+
 	* completer.c (complete_line): Remove incorrect comment.
 
 2015-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 84e2680..5302afa 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5062,6 +5062,7 @@ completion_list_add_name (const char *symname,
 	VEC_safe_push (char_ptr, return_val, new);
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_MAX_REACHED:
+	xfree (new);
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_DUPLICATE:
 	xfree (new);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]