diff options
author | Saurav Babu <saurav.babu@samsung.com> | 2016-05-06 16:01:05 +0530 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2016-05-31 10:18:50 +0300 |
commit | a8a2ad2a3a14bfe6925dee8b922b20526a8f16e2 (patch) | |
tree | 10e5a97b69ed1ab556495f438c19f04c1b8ae0c3 | |
parent | b0bb2e4bb17396fef80630c7e66b3956c4a4e665 (diff) | |
download | connman-a8a2ad2a3a14bfe6925dee8b922b20526a8f16e2.tar.gz |
wifi: No need to allocate and free memory if ifname is NULL
g_strdup() will return NULL only when ifname is NULL. This patch checks
ifname before any memory allocation and free is done.
-rw-r--r-- | plugins/wifi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index 702ade96..9d566713 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -3186,6 +3186,8 @@ static int enable_wifi_tethering(struct connman_technology *technology, continue; ifname = g_supplicant_interface_get_ifname(wifi->interface); + if (!ifname) + continue; if (wifi->ap_supported == WIFI_AP_NOT_SUPPORTED) { DBG("%s does not support AP mode (detected)", ifname); @@ -3220,8 +3222,6 @@ static int enable_wifi_tethering(struct connman_technology *technology, goto failed; info->ifname = g_strdup(ifname); - if (!info->ifname) - goto failed; wifi->tethering_param->technology = technology; wifi->tethering_param->ssid = ssid_ap_init(identifier, passphrase); |