Resolved ASAN issues 49/214449/9 accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.031205 accepted/tizen/5.5/unified/mobile/hotfix/20201027.065642 accepted/tizen/5.5/unified/wearable/hotfix/20201027.121533 accepted/tizen/unified/20190925.220351 submit/tizen/20190924.093031 submit/tizen_5.5/20191031.000002 submit/tizen_5.5_mobile_hotfix/20201026.185102 submit/tizen_5.5_wearable_hotfix/20201026.184302 tizen_5.5.m2_release
authorAbhimanyu Swami <abhimanyu1.s@samsung.com>
Mon, 23 Sep 2019 06:17:28 +0000 (11:47 +0530)
committerAbhimanyu Swami <abhimanyu1.s@samsung.com>
Mon, 23 Sep 2019 09:09:53 +0000 (09:09 +0000)
Change-Id: If704140344bda71e3257f7aed483b76f6507407f
Signed-off-by: Abhimanyu Swami <abhimanyu1.s@samsung.com>
src/location_internal.c
src/locations.c

index 054a4a0..ede0a44 100644 (file)
@@ -179,8 +179,12 @@ int __set_callback(_location_event_e type, location_manager_h manager, void *cal
        LOCATIONS_NULL_ARG_CHECK(manager);
        LOCATIONS_NULL_ARG_CHECK(callback);
        location_manager_s *handle = (location_manager_s *) manager;
-       handle->user_cb[type] = callback;
-       handle->user_data[type] = user_data;
+       if (handle != NULL){
+               handle->user_cb[type] = callback;
+               handle->user_data[type] = user_data;
+       }
+       else
+               LOCATIONS_LOGE("Null Handle");
        LOCATIONS_LOGD("event type : %d", type);
        return LOCATIONS_ERROR_NONE;
 }
@@ -189,8 +193,12 @@ int __unset_callback(_location_event_e type, location_manager_h manager)
 {
        LOCATIONS_NULL_ARG_CHECK(manager);
        location_manager_s *handle = (location_manager_s *) manager;
-       handle->user_cb[type] = NULL;
-       handle->user_data[type] = NULL;
+       if (handle != NULL){
+               handle->user_cb[type] = NULL;
+               handle->user_data[type] = NULL;
+       }
+       else
+               LOCATIONS_LOGE("Null Handle");
        LOCATIONS_LOGD("event type : %d", type);
        return LOCATIONS_ERROR_NONE;
 }
index 36165c5..942f4c1 100755 (executable)
@@ -573,6 +573,7 @@ EXPORT_API int location_manager_destroy(location_manager_h manager)
                return __convert_error_code(ret);       //LCOV_EXCL_LINE
 
        free(handle);
+       handle = NULL;
        return LOCATIONS_ERROR_NONE;
 }
 
@@ -738,7 +739,10 @@ EXPORT_API int location_manager_get_method(location_manager_h manager, location_
 
        location_manager_s *handle = (location_manager_s *) manager;
        LocationMethod _method = LOCATION_METHOD_NONE;
-       g_object_get(handle->object, "method", &_method, NULL);
+       if (handle != NULL)
+               g_object_get(handle->object, "method", &_method, NULL);
+       else
+               LOCATIONS_LOGE("Null Handle");
        switch (_method) {
        case LOCATION_METHOD_NONE:
                *method = LOCATIONS_METHOD_NONE;
@@ -952,7 +956,10 @@ EXPORT_API int location_manager_get_last_location(location_manager_h manager, do
        LocationPosition *last_pos = NULL;
        LocationVelocity *last_vel = NULL;
        LocationAccuracy *last_acc = NULL;
-       ret = location_get_last_position_ext(handle->object, &last_pos, &last_vel, &last_acc);
+       if (handle != NULL)
+               ret = location_get_last_position_ext(handle->object, &last_pos, &last_vel, &last_acc);
+       else
+               LOCATIONS_LOGE("Null Handle");
        if (ret != LOCATION_ERROR_NONE)
                return __convert_error_code(ret);       //LCOV_EXCL_LINE
 
@@ -1090,7 +1097,10 @@ EXPORT_API int location_manager_set_location_changed_cb(location_manager_h manag
        LOCATIONS_CHECK_CONDITION(interval >= 1 && interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
        LOCATIONS_NULL_ARG_CHECK(manager);
        location_manager_s *handle = (location_manager_s *) manager;
-       g_object_set(handle->object, "loc-interval", interval, NULL);
+       if (handle != NULL)
+               g_object_set(handle->object, "loc-interval", interval, NULL);
+       else
+               LOCATIONS_LOGE("Null Handle");
        return __set_callback(_LOCATIONS_EVENT_TYPE_POS_VEL, manager, callback, user_data);
 }
 
@@ -1257,8 +1267,11 @@ EXPORT_API int gps_status_get_nmea(location_manager_h manager, char **nmea)
        LOCATIONS_NULL_ARG_CHECK(nmea);
        location_manager_s *handle = (location_manager_s *) manager;
        char *nmea_data;
-
-       int ret = location_get_nmea(handle->object, &nmea_data);
+       int ret = 0;
+       if (handle != NULL)
+                ret = location_get_nmea(handle->object, &nmea_data);
+       else
+               LOCATIONS_LOGE("Null Handle");
        if (ret != LOCATION_ERROR_NONE || nmea == NULL) {
                //LCOV_EXCL_START
                if (ret == LOCATION_ERROR_NOT_ALLOWED) {