diff mbox

Fix memory leak in watch_main_source_file_lossage

Message ID m3h9y61rib.fsf@sspiff.org
State New
Headers show

Commit Message

Doug Evans Nov. 11, 2014, 12:59 a.m. UTC
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.

Comments

Doug Evans Nov. 18, 2014, 5:06 p.m. UTC | #1
On Mon, Nov 10, 2014 at 4:59 PM, Doug Evans <xdje42@gmail.com> wrote:
> 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.

Committed.
diff mbox

Patch

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);
 	}
     }