From 67014112bc78a2b6fa7857bf637ce646fa61cb75 Mon Sep 17 00:00:00 2001 From: Jaehyun Kim Date: Fri, 7 Jan 2022 12:12:15 +0900 Subject: [PATCH] Fix dereference after null check Change-Id: If0c7f97ce58436c6cce1debf92f2fafb407ff9fe Signed-off-by: Jaehyun Kim --- plugins/wifi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/wifi.c b/plugins/wifi.c index 7c15996..3b709d8 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -2282,7 +2282,10 @@ static void scan_callback(int result, GSupplicantInterface *interface, connman_device_unref(device); #if defined TIZEN_EXT - if (wifi && wifi->scan_pending_network && result != -EIO) { + if (!wifi) + goto done; + + if (wifi->scan_pending_network && result != -EIO) { network_connect(wifi->scan_pending_network); wifi->scan_pending_network = NULL; connman_network_set_connecting(wifi->network); @@ -4156,9 +4159,10 @@ static void signalpoll_callback(int result, int maxspeed, int strength, if (need_bss_transition(freq, snr, strength)) { device = connman_network_get_device(network); - if (device) - interface = connman_device_get_string(device, "Interface"); + if (!device) + goto done; + interface = connman_device_get_string(device, "Interface"); bssid = connman_network_get_bssid(network); snprintf(bssid_str, WIFI_BSSID_STR_LEN, MACSTR, MAC2STR(bssid)); __connman_technology_notify_roaming_state(interface, "required", bssid_str, NULL); -- 2.7.4