From: Leena Gunda Date: Thu, 6 Jan 2011 05:49:51 +0000 (+0530) Subject: Fix Valgrind invalid write error for WiFi plugin X-Git-Tag: 0.66~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b35c5c84316d50a04c23ae09885390a71ff58f8d;p=platform%2Fupstream%2Fconnman.git 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 --- 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;