Use g_new instead of calloc 86/230386/1 accepted/tizen/unified/20200411.115615 submit/tizen/20200410.073041
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 9 Apr 2020 23:33:42 +0000 (08:33 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 9 Apr 2020 23:33:42 +0000 (08:33 +0900)
Change-Id: I6e1f3a1f885c7fc8b3fee4024634d750d5535d35
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/common/media-svc-media.c
src/common/media-svc.c

index a9d503b..1722c2a 100755 (executable)
@@ -491,11 +491,7 @@ int _media_svc_get_noti_info(sqlite3 *handle, const char *path, media_svc_noti_i
        ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
        media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "_media_svc_sql_prepare_to_step() failed [%d]", ret);
 
-       *item = calloc(1, sizeof(media_svc_noti_item));
-       if (*item == NULL) {
-               media_svc_error("Allocation failed");
-               return MS_MEDIA_ERR_OUT_OF_MEMORY;
-       }
+       *item = g_new0(media_svc_noti_item, 1);
 
        (*item)->media_uuid = g_strdup((const char *)sqlite3_column_text(sql_stmt, 0));
        (*item)->media_type = sqlite3_column_int(sql_stmt, 1);
index 3ec4ce7..aff037b 100755 (executable)
@@ -592,10 +592,7 @@ int media_svc_update_item_meta(sqlite3 *handle, uid_t uid)
        char *sql = NULL;
        char *file_path = NULL;
        media_svc_content_info_s content_info;
-       GPtrArray *path_list = NULL;
-
-       path_list = g_ptr_array_new_with_free_func(g_free);
-       media_svc_retvm_if(!path_list, MS_MEDIA_ERR_OUT_OF_MEMORY, "Allocation failed");
+       GPtrArray *path_list = g_ptr_array_new_with_free_func(g_free);
 
        sql = sqlite3_mprintf("SELECT media_path FROM %q WHERE media_type=3 AND validity=1", DB_TABLE_MEDIA);
        ret = _media_svc_get_media(handle, sql, &path_list);