Fix issue detected by static analysis tool 42/318842/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 27 Jan 2025 08:30:26 +0000 (17:30 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 27 Jan 2025 08:30:50 +0000 (17:30 +0900)
Change-Id: I311a652e8ef92139c3759aff7325e8e800bf314a
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
server/stickerd_db_manager.c
sticker-parser/sticker-parser.c

index 5cbe5661a66ab41d9acac5ed1b0f0194ab5a0152..4232603a3ea65126a292fdad2cab3a1274a23e98 100644 (file)
@@ -251,6 +251,9 @@ static int _recover_db(void)
         goto cleanup;
     }
 
+    if (!db)
+        return STICKERD_SERVER_ERROR_DB_FAILED;
+
     ret = _create_db_table(db);
     if (ret != SQLITE_OK)
         goto cleanup;
@@ -289,6 +292,9 @@ int stickerd_db_init(void)
         goto cleanup;
     }
 
+    if (!db)
+        return STICKERD_SERVER_ERROR_DB_FAILED;
+
     ret = _create_db_table(db);
     if (ret != SQLITE_OK)
         goto cleanup;
index f72286b728ea55128591ee6f167aab63a0750847..fdcedaab4b3b75d3614f17e3b6e1228a34e9e2b5 100644 (file)
@@ -115,6 +115,9 @@ static void __recover_db()
         goto cleanup;
     }
 
+    if (!db)
+        return;
+
     ret = sqlite3_exec(db, STICKER_INFO_CREATE_TABLE, NULL, NULL, &err);
     if (ret != SQLITE_OK) {
         LOGE("Failed to create sticker_info table : %s" , err);
@@ -180,6 +183,9 @@ static void __db_init()
         goto cleanup;
     }
 
+    if (!db)
+        return;
+
     if (__change_ownership(db_path, UIFW_ID, UIFW_ID) != 0)
         LOGE("failed to change ownership");