wifi: Add NULL checks in interface create and remove
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 6 Sep 2011 07:13:16 +0000 (10:13 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 12 Sep 2011 10:14:14 +0000 (12:14 +0200)
Interface create and remove callbacks can be called with wifi user data
set to NULL, add checks for this.

plugins/wifi.c

index 7ed2814..ee30586 100644 (file)
@@ -200,10 +200,11 @@ static void interface_create_callback(int result,
 {
        struct wifi_data *wifi = user_data;
 
-       DBG("result %d ifname %s", result,
-                               g_supplicant_interface_get_ifname(interface));
+       DBG("result %d ifname %s, wifi %p", result,
+                               g_supplicant_interface_get_ifname(interface),
+                               wifi);
 
-       if (result < 0)
+       if (result < 0 || wifi == NULL)
                return;
 
        wifi->interface = interface;
@@ -216,9 +217,9 @@ static void interface_remove_callback(int result,
 {
        struct wifi_data *wifi = user_data;
 
-       DBG("result %d", result);
+       DBG("result %d wifi %p", result, wifi);
 
-       if (result < 0)
+       if (result < 0 || wifi == NULL)
                return;
 
        wifi->interface = NULL;