Fix Valgrind invalid write error for WiFi plugin
authorLeena Gunda <leena.gunda@wipro.com>
Thu, 6 Jan 2011 05:49:51 +0000 (11:19 +0530)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 6 Jan 2011 06:04:39 +0000 (22:04 -0800)
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

index 8452656..6302af0 100644 (file)
@@ -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;