d2d-subowner: fix crash issue when timerout callback executed before discover_done_cb
authorsaerome.kim <saerome.kim@samsung.com>
Thu, 11 Jan 2018 06:34:03 +0000 (15:34 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:38:38 +0000 (19:38 +0900)
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
src/d2d-subowner/d2ds-subowner.c

index 6be07f1ef5937546e4b7d0afe9f85c16995b6f91..7c437153876585d5dc6e0f9f27956bdd3ead286a 100644 (file)
@@ -682,11 +682,7 @@ static void __notify_found_devs(void  *data)
                char uuid_string[256] = {0};
 
                OicUuid_t *uuid = &iter->doxm->deviceID;
-
-               if (!uuid) {
-                       D2DS_LOGW("Invalid deviceid");
-                       continue;
-               }
+               d2ds_check_null_ret("uuid", uuid);
 
                snprintf(uuid_string, sizeof(uuid_string),
                        "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
@@ -846,7 +842,7 @@ static int _disc_mot_enb_devs(d2ds_service *service)
        con->userdata = service;
        con->cid = D2DS_DISC_MOT_ENB_DEVS;
 #ifdef TIMEOUT_USED
-       con->tid = g_timeout_add_seconds(DISCOVERY_TIMEOUT + 1, _d2ds_timeout_cb, con);
+       con->tid = g_timeout_add_seconds(DISCOVERY_TIMEOUT * 2, _d2ds_timeout_cb, con);
 #endif
        return D2DS_ERROR_NONE;
 }
@@ -897,7 +893,7 @@ static int _disc_owned_devs(d2ds_service *service)
        }
        g_thread_unref(con->thread);
 #ifdef TIMEOUT_USED
-       con->tid = g_timeout_add_seconds(DISCOVERY_TIMEOUT + 1, _d2ds_timeout_cb, con);
+       con->tid = g_timeout_add_seconds(DISCOVERY_TIMEOUT * 2, _d2ds_timeout_cb, con);
 #endif
        return D2DS_ERROR_NONE;
 }