Fix the dangling pointer(network) inside autosignalpoll_timeout(). 46/200046/2 accepted/tizen/unified/20190219.154224 submit/tizen/20190218.125443
authorLokesh <l.kasana@samsung.com>
Mon, 18 Feb 2019 10:03:04 +0000 (15:33 +0530)
committerLokesh <l.kasana@samsung.com>
Mon, 18 Feb 2019 10:24:34 +0000 (15:54 +0530)
Change-Id: I47d74342b861db29c2b36094539a84b73dce7e55
Signed-off-by: Lokesh <l.kasana@samsung.com>
packaging/connman.spec
plugins/wifi.c

index e5e1b0e..961f3ee 100644 (file)
@@ -5,7 +5,7 @@
 
 Name:           connman
 Version:        1.35
-Release:        30
+Release:        31
 License:        GPL-2.0+
 Summary:        Connection Manager
 Url:            http://connman.net
index 71727e6..9b2e9e1 100644 (file)
@@ -3535,20 +3535,21 @@ static int network_signalpoll(struct connman_network *network)
 
 static gboolean autosignalpoll_timeout(gpointer data)
 {
-       struct connman_network *network = data;
-       int ret = 0;
+       if (!automaxspeed_timeout) {
+               DBG("automaxspeed_timeout is found to be zero. i.e. currently in disconnected state. !!");
+               return FALSE;
+       }
 
-       automaxspeed_timeout = 0;
-       ret = network_signalpoll(network);
+       struct connman_network *network = data;
+       int ret = network_signalpoll(network);
 
        if (ret < 0) {
                DBG("Fail to get max speed !!");
+               automaxspeed_timeout = 0;
                return FALSE;
        }
 
-       automaxspeed_timeout = g_timeout_add_seconds(30, autosignalpoll_timeout, network);
-
-       return FALSE;
+       return TRUE;
 }
 #endif
 
@@ -3904,7 +3905,11 @@ static void interface_state(GSupplicantInterface *interface)
 
                if (!automaxspeed_timeout) {
                        DBG("Going to start signalpoll timer!!");
-                       autosignalpoll_timeout(network);
+                       int ret = network_signalpoll(network);
+                       if (ret < 0)
+                               DBG("Fail to get max speed !!");
+                       else
+                               automaxspeed_timeout = g_timeout_add_seconds(30, autosignalpoll_timeout, network);
                }
 #else
                /* though it should be already stopped: */