Fix issues detected by static analysis tool 71/229371/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 31 Mar 2020 11:40:26 +0000 (20:40 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 31 Mar 2020 11:40:35 +0000 (20:40 +0900)
Change-Id: I19d0a8dd76c0b4f9e58ce1541a995ca6a2e3f020
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
server/stickerd_db_manager.c
sticker-parser/sticker-parser.c

index dbefbb7..3adda1b 100644 (file)
@@ -188,6 +188,7 @@ static int _recover_db(void)
     if (ret != SQLITE_OK) {
         LOGE("Failed to create sticker_keyword_info table : %s", err);
         ret = STICKERD_SERVER_ERROR_DB_FAILED;
+        goto cleanup;
     }
 
     ret = sqlite3_exec(db, STICKER_WHITELIST_INFO_CREATE_TABLE, NULL, NULL, &err);
@@ -251,6 +252,7 @@ int stickerd_db_init(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, "PRAGMA journal_mode = WAL", NULL, NULL, &err);
index d5a3bd4..2c3eb73 100644 (file)
@@ -599,8 +599,10 @@ static int __get_sticker_info_from_json(const char *appid, const char *file_path
                 goto free_memory;
 
             thumbnail = __get_string_from_object(info_object, "thumbnail");
-            if (thumbnail)
+            if (thumbnail) {
+                free(thumbnail);
                 thumbnail = __convert_sticker_uri(thumbnail, appid, app_path);
+            }
 
             description = __get_string_from_object(info_object, "description");
             int disp_type = __get_int_from_object(info_object, "display_type");