From 9fb918f4d319795699b9963c3eaa58246227dede Mon Sep 17 00:00:00 2001 From: Danny Kukawka Date: Wed, 17 Oct 2007 13:25:09 +0200 Subject: [PATCH] fix GSList related memory leaks This fixes several memory leaks caused by not free'd GSList objects. --- hald/device_info.c | 1 + hald/linux/apm.c | 1 + hald/linux/hotplug.c | 2 ++ hald/linux/pmu.c | 2 ++ 4 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hald/device_info.c b/hald/device_info.c index 2b18346..438ec52 100644 --- a/hald/device_info.c +++ b/hald/device_info.c @@ -621,6 +621,7 @@ handle_match (struct rule *rule, HalDevice *d) break; } /* for all siblings */ + g_slist_free (siblings); } return contains; diff --git a/hald/linux/apm.c b/hald/linux/apm.c index 11f56b9..79c54ad 100644 --- a/hald/linux/apm.c +++ b/hald/linux/apm.c @@ -81,6 +81,7 @@ apm_poll (gpointer data) apm_rescan_device (d); } + g_slist_free (devices); return TRUE; } diff --git a/hald/linux/hotplug.c b/hald/linux/hotplug.c index d57a022..56db041 100644 --- a/hald/linux/hotplug.c +++ b/hald/linux/hotplug.c @@ -409,6 +409,7 @@ hotplug_reprobe_generate_remove_events (HalDevice *d) child = HAL_DEVICE (i->data); hotplug_reprobe_generate_remove_events (child); } + g_slist_free (childs); /* then remove self */ HAL_INFO (("Generate remove event for udi %s", hal_device_get_udi (d))); @@ -492,6 +493,7 @@ hotplug_reprobe_generate_add_events (HalDevice *d) child = HAL_DEVICE (i->data); hotplug_reprobe_generate_add_events (child); } + g_slist_free (childs); } gboolean diff --git a/hald/linux/pmu.c b/hald/linux/pmu.c index d8f6fc3..451ffac 100644 --- a/hald/linux/pmu.c +++ b/hald/linux/pmu.c @@ -251,6 +251,7 @@ pmu_poll (gpointer data) } } + g_slist_free (devices); devices = hal_device_store_match_multiple_key_value_string (hald_get_gdl (), "info.category", "ac_adapter"); @@ -266,6 +267,7 @@ pmu_poll (gpointer data) } } + g_slist_free (devices); return TRUE; } -- 1.5.3.7