Fix coverity issue 41/224341/2
authorjiyong.min <jiyong.min@samsung.com>
Mon, 10 Feb 2020 03:44:25 +0000 (12:44 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Mon, 10 Feb 2020 03:46:27 +0000 (12:46 +0900)
 - ALLOC_FREE_MISMATCH

Change-Id: I5545e0c76c221690308890a7f30cf79b072c317f

include/media_info_private.h
include_product/media_info_private.h
packaging/capi-content-media-content.spec
src/media_content.c
src/media_info.c

index fd12faa61fa3473928b52d42cce81c76224d2c98..35c02616250d48e0abdffee21b3424b204a077bd 100755 (executable)
@@ -59,6 +59,7 @@ extern "C" {
 #define SAFE_STRLCPY(dst, src, n)      ((g_strlcpy(dst, src, n) < n) ? TRUE : FALSE)
 #define SAFE_STRLCAT(dst, src, n)      g_strlcat(dst, src, n);
 #define SAFE_FREE(src)         {if (src) {free(src); src = NULL; } }
+#define SAFE_G_FREE(src)               {if (src) {g_free(src); src = NULL; } }
 #define STRING_VALID(str)              ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
 #define SQLITE3_FINALIZE(x)    {if (x != NULL) sqlite3_finalize(x); }
 #define SQLITE3_SAFE_FREE(x)   {if (x != NULL) {sqlite3_free(x); x = NULL; } }
index e25cb0d30c55f48fc3d75f15ed0d2db6ee4aa06b..73e7f3fbbdf28e9b22f8098126450ba79fbd5cb8 100755 (executable)
@@ -62,6 +62,7 @@ extern "C" {
 #define SAFE_STRLCPY(dst, src, n)      ((g_strlcpy(dst, src, n) < n) ? TRUE : FALSE)
 #define SAFE_STRLCAT(dst, src, n)      g_strlcat(dst, src, n);
 #define SAFE_FREE(src)         {if (src) {free(src); src = NULL; } }
+#define SAFE_G_FREE(src)               {if (src) {g_free(src); src = NULL; } }
 #define STRING_VALID(str)              ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
 #define SQLITE3_FINALIZE(x)    {if (x != NULL) sqlite3_finalize(x); }
 #define SQLITE3_SAFE_FREE(x)   {if (x != NULL) {sqlite3_free(x); x = NULL; } }
index c5b116610d34069b84ce3a16a2ba31c695831283..bc02020d3b46e27a8944764b965f12f642fd37b4 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-content-media-content
 Summary:    A Media content library in Tizen Native API
-Version:    0.4.6
+Version:    0.4.7
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 1e5c8948d8e7490d56f73d9e713e9e93968d5379..1d5e4f116d7305cf9090e7a728f323b574364f4f 100644 (file)
@@ -275,7 +275,7 @@ int media_content_scan_file(const char *path)
                /* This means this path has to be inserted or refreshed */
                folder_path = g_path_get_dirname(repl_path);
                ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
-               SAFE_FREE(folder_path);
+               SAFE_G_FREE(folder_path);
 
                media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
                /* check feature */
index 0f9c40a370153cb6a27378ce57b2ef2c216857f1..fcc137e04cd1f95aae9108a2bf0b596871b1d2a4 100644 (file)
@@ -265,7 +265,7 @@ static int __media_info_check_file_validity(const char *path)
 
        folder_path = g_path_get_dirname(path);
        ret = _media_util_check_ignore_dir(folder_path, &ignore);
-       SAFE_FREE(folder_path);
+       SAFE_G_FREE(folder_path);
        media_content_retvm_if(ignore == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
 
        return MEDIA_CONTENT_ERROR_NONE;