Fix coverity issue(Resource leak) 27/307927/6
authorJiyong <jiyong.min@samsung.com>
Thu, 14 Mar 2024 08:51:25 +0000 (17:51 +0900)
committerJiyong <jiyong.min@samsung.com>
Fri, 15 Mar 2024 01:05:56 +0000 (10:05 +0900)
 - The media_directory_scanning_async has been changed to free cb_data.

Change-Id: I12d77e9716baefeaf5a9383c3298ec31568ec0b4

packaging/capi-content-media-content.spec
src/media_content.c
src/media_info.c

index cc1c545..9aeb6d7 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-content-media-content
 Summary:    A Media content library in Tizen Native API
-Version:    0.4.26
+Version:    0.4.27
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 7550c65..360a59f 100644 (file)
@@ -442,8 +442,10 @@ int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan
        /*FIX ME. need to check ret value?*/
 
        ret = media_directory_scanning_async(path, storage_id, is_recursive, _media_content_scan_cb_v2, cb_data, _content_get_uid());
-       if (ret != MS_MEDIA_ERR_NONE)
+       if (ret != MS_MEDIA_ERR_NONE) {
                content_error("media_directory_scanning_async failed : %d", ret);
+               g_free(cb_data);
+       }
 
        return _content_error_capi(ret);
 }
index e29d17c..c98e6a9 100644 (file)
@@ -153,6 +153,7 @@ static int __media_info_insert_batch(const char **path_array,
                content_error("media_files_register failed : %d", ret);
                if (unlink(list_path) < 0)
                        content_stderror("failed to delete");
+               g_free(_cb_data);
                return _content_error_capi(ret);
        }