Fix issue detected by static analysis tool 88/230988/1
authorInHong Han <inhong1.han@samsung.com>
Thu, 16 Apr 2020 10:42:01 +0000 (19:42 +0900)
committerInHong Han <inhong1.han@samsung.com>
Thu, 16 Apr 2020 10:42:01 +0000 (19:42 +0900)
Change-Id: I1f9c417f1c11bc72d214d45a27ffe78695371301

server/stickerd_data_manager.c
server/stickerd_db_manager.c
sticker-parser/sticker-parser.c

index 2bb0012..9e6455c 100644 (file)
@@ -874,7 +874,7 @@ int stickerd_insert_sticker_info_by_json(GVariant *parameters, GVariant **reply_
                 goto free_memory;
 
             sticker_info->uri = _get_string_from_object(info_object, "uri");
-            if (!sticker_info->uri)
+            if (!sticker_info->uri || sticker_info->uri[0] != '\0')
                 goto free_memory;
 
             if (sticker_info->type == 1) {
index f3acdbd..ad78560 100644 (file)
@@ -211,12 +211,14 @@ static int _recover_db(void)
     if (ret != SQLITE_OK) {
         LOGE("Failed to create sticker_whitelist_info table : %s", err);
         ret = STICKERD_SERVER_ERROR_DB_FAILED;
+        goto cleanup;
     }
 
     ret = sqlite3_exec(db, STICKER_RECENT_HISTORY_INFO_CREATE_TABLE, NULL, NULL, &err);
     if (ret != SQLITE_OK) {
         LOGE("Failed to create sticker_recent_history_info table : %s", err);
         ret = STICKERD_SERVER_ERROR_DB_FAILED;
+        goto cleanup;
     }
 
     is_corrupted = FALSE;
index a3f96b5..9d73dd3 100644 (file)
@@ -605,7 +605,7 @@ static int __get_sticker_info_from_json(const char *appid, const char *file_path
                 goto free_memory;
 
             char *rel_thumbnail = __get_string_from_object(info_object, "thumbnail");
-            if (rel_thumbnail) {
+            if (rel_thumbnail && rel_thumbnail[0] != '\0') {
                 thumbnail_path = __convert_sticker_uri(rel_thumbnail, appid, app_path);
                 free(rel_thumbnail);
             }