From 988a7a8d7c4bdc40e770f0a20f2da33e49386207 Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Tue, 6 Sep 2011 10:13:16 +0300 Subject: [PATCH] wifi: Add NULL checks in interface create and remove Interface create and remove callbacks can be called with wifi user data set to NULL, add checks for this. --- plugins/wifi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/wifi.c b/plugins/wifi.c index 7ed2814..ee30586 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -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; -- 2.7.4