vpn: Fix null pointer dereference
authorHenrique Dante de Almeida <hdante@profusion.mobi>
Tue, 8 May 2012 19:20:54 +0000 (16:20 -0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 9 May 2012 14:15:25 +0000 (17:15 +0300)
plugins/vpn.c

index e442306..165c325 100644 (file)
@@ -162,10 +162,12 @@ vpn_exit:
                                                CONNMAN_PROVIDER_STATE_IDLE);
 
        connman_provider_set_index(provider, -1);
-       connman_provider_unref(data->provider);
 
-       g_free(data->if_name);
-       g_free(data);
+       if (data != NULL) {
+               connman_provider_unref(data->provider);
+               g_free(data->if_name);
+               g_free(data);
+       }
 
        connman_task_destroy(task);
 }