Fix SEGV at first startup
authorDavid Woodhouse <dwmw2@infradead.org>
Fri, 9 Jul 2010 21:45:24 +0000 (23:45 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 9 Jul 2010 21:45:24 +0000 (23:45 +0200)
connman_wifi_load_ssid() can return NULL. Best not to dereference that.
This fixes Meego's bug #3787.

plugins/supplicant.c

index 276fd91..85016ba 100644 (file)
@@ -610,7 +610,13 @@ static void add_interface_reply(DBusPendingCall *call, void *user_data)
 
        connman_device_set_powered(task->device, TRUE);
 
+       dbus_message_unref(reply);
+
+       dbus_pending_call_unref(call);
+
        hex_ssids = connman_wifi_load_ssid();
+       if (hex_ssids == NULL)
+               return;
 
        for (i = 0; hex_ssids[i]; i++) {
                unsigned char *ssid;
@@ -635,10 +641,6 @@ static void add_interface_reply(DBusPendingCall *call, void *user_data)
 
        g_strfreev(hex_ssids);
 
-       dbus_message_unref(reply);
-
-       dbus_pending_call_unref(call);
-
        return;
 
 failed: