Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH] wifi: No need to allocate and free memory if ifname
      is NULL (Saurav Babu)


----------------------------------------------------------------------

Message: 1
Date: Fri, 06 May 2016 16:01:05 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected], Saurav Babu <[email protected]>
Subject: [PATCH] wifi: No need to allocate and free memory if ifname
        is NULL
Message-ID:
        <[email protected]>

g_strdup() will return NULL only when ifname is NULL. This patch checks
ifname before any memory allocation and free is done.
---
 plugins/wifi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index bb1cabc..09e83ca 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -3114,6 +3114,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);
@@ -3148,8 +3150,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);
-- 
1.9.1



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 7, Issue 4
*************************************

Reply via email to