Fix coverity issue 07/258607/3
authorsooyeon.kim <sooyeon.kim@samsung.com>
Fri, 21 May 2021 05:36:48 +0000 (14:36 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Fri, 21 May 2021 06:14:21 +0000 (15:14 +0900)
* Remove unnecessary null checkers
* Add a checker of the integer range

Change-Id: Ide9a5b13762a4da296f6b87e33bdbc76ccc8d857
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
client/gesture.c
server/gestured_dbus.c

index abed09d..236dfcc 100644 (file)
@@ -129,8 +129,6 @@ EXPORT_API int hand_gesture_create(hand_gesture_h *handle)
        ASSERT_NOT_NULL(handle);
 
        int ret;
-       if (!handle)
-               return HAND_GESTURE_ERROR_INVALID_PARAMETER;
 
        if (_gesture_check_privilege() != HAND_GESTURE_ERROR_NONE)
                return HAND_GESTURE_ERROR_PERMISSION_DENIED;
@@ -177,8 +175,6 @@ EXPORT_API int hand_gesture_destroy(hand_gesture_h handle)
        ASSERT_NOT_NULL(handle);
 
        int ret;
-       if (!handle)
-               return HAND_GESTURE_ERROR_INVALID_PARAMETER;
 
        LOGD("handle : %p", handle);
        ret = gesture_client_dbus_shutdown(handle->gdbus_connection, &handle->server_monitor_id, &handle->monitor_id);
index f33ef15..10f5922 100644 (file)
@@ -573,6 +573,11 @@ int gestured_register_dbus_interface(void)
 
        fseek(xml_file, 0, SEEK_END);
        size = ftell(xml_file);
+       if (0 >= size) {
+               LOGE("Fail to get xml file");
+               fclose(xml_file);
+               return GESTURED_ERROR_OPERATION_FAILED;
+       }
        rewind(xml_file);
 
        introspection_xml = (char*)calloc(sizeof(char), size);