diff mbox

[3/3] windows_clear_solib memory leak

Message ID 20191224122452.1668-3-ssbssa@yahoo.de
State New
Headers show

Commit Message

Doug Evans via gdb-patches Dec. 24, 2019, 12:24 p.m. UTC
gdb/ChangeLog:

2019-12-24  Hannes Domani  <ssbssa@yahoo.de>

	* windows-nat.c (windows_clear_solib): Free so_list linked list.
---
 gdb/windows-nat.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Tom Tromey Jan. 3, 2020, 4:44 p.m. UTC | #1
>>>>> "Hannes" == Hannes Domani via gdb-patches <gdb-patches@sourceware.org> writes:

Hannes> gdb/ChangeLog:
Hannes> 2019-12-24  Hannes Domani  <ssbssa@yahoo.de>

Hannes> 	* windows-nat.c (windows_clear_solib): Free so_list linked list.

Thanks, this is ok.

Tom
diff mbox

Patch

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 10d5c95d09..02c4269d5a 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -940,7 +940,14 @@  catch_errors (void (*func) ())
 static void
 windows_clear_solib (void)
 {
-  solib_start.next = NULL;
+  struct so_list *so;
+
+  for (so = solib_start.next; so; so = solib_start.next)
+    {
+      solib_start.next = so->next;
+      windows_free_so (so);
+    }
+
   solib_end = &solib_start;
 }