From b35c5c84316d50a04c23ae09885390a71ff58f8d Mon Sep 17 00:00:00 2001 From: Leena Gunda Date: Thu, 6 Jan 2011 11:19:51 +0530 Subject: [PATCH] Fix Valgrind invalid write error for WiFi plugin g_supplicant_unregister first destroys the interface table and then invokes system_killed callback which will trigger wifi device driver removal. wifi_remove will now set it's interface data to NULL but the GSupplicantInterface has already been freed and hence the issue. Invoking the system_killed callback before destroying the interface table in gsupplicant will fix this issue. Fixes BMC#11684 --- gsupplicant/supplicant.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 8452656..6302af0 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2633,6 +2633,9 @@ void g_supplicant_unregister(const GSupplicantCallbacks *callbacks) bss_mapping = NULL; } + if (system_available == TRUE) + callback_system_killed(); + if (interface_table != NULL) { g_hash_table_foreach(interface_table, unregister_remove_interface, NULL); @@ -2640,9 +2643,6 @@ void g_supplicant_unregister(const GSupplicantCallbacks *callbacks) interface_table = NULL; } - if (system_available == TRUE) - callback_system_killed(); - if (connection != NULL) { dbus_connection_unref(connection); connection = NULL; -- 2.7.4