This is the mail archive of the gdb-patches@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]

[PATCH] Fix memory leak in watch_main_source_file_lossage


Hi.

I happened to notice this memory leak while hacking on buildsym.c.

Regression tested on amd64-linux.

2014-11-10  Doug Evans  <xdje42@gmail.com>

	* buildsym.c (watch_main_source_file_lossage): Fix memory leak.

diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index ef7e809..5a4fa06 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1002,6 +1002,8 @@ watch_main_source_file_lossage (void)
 	    subfiles = mainsub_alias->next;
 	  else
 	    prev_mainsub_alias->next = mainsub_alias->next;
+	  xfree (mainsub_alias->name);
+	  xfree (mainsub_alias->dirname);
 	  xfree (mainsub_alias);
 	}
     }


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