Fix issue detected by static analysis tool 13/263513/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 6 Sep 2021 00:52:26 +0000 (09:52 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 6 Sep 2021 00:54:28 +0000 (09:54 +0900)
Change-Id: I44ca1ca13b33e9f6dc014a7700fca22f4f7322b1
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
server/stickerd_data_manager.c

index 3210959..ac976f2 100644 (file)
@@ -862,6 +862,7 @@ int stickerd_insert_sticker_info_by_json(GVariant *parameters, GVariant **reply_
     JsonArray *keyword_arr = NULL;
     int arr_len = 0;
     int keyword_arr_len = 0;
+    const char *keyword = NULL;
 
     JsonNode *root = NULL;
     JsonObject *root_obj = NULL;
@@ -967,7 +968,9 @@ int stickerd_insert_sticker_info_by_json(GVariant *parameters, GVariant **reply_
                 goto free_memory;
 
             for (int j = 0; j < keyword_arr_len; j++) {
-                sticker_info->keyword = g_list_append(sticker_info->keyword, strdup((const char *)json_array_get_string_element(keyword_arr, j)));
+                keyword = json_array_get_string_element(keyword_arr, j);
+                if (keyword)
+                    sticker_info->keyword = g_list_append(sticker_info->keyword, strdup(keyword));
             }
 
             ret = stickerd_db_insert_sticker_info(&record_id, sticker_info);
@@ -1898,4 +1901,4 @@ int stickerd_get_group_image_list(GVariant *parameters, GVariant **reply_body)
     }
 
     return ret;
-}
\ No newline at end of file
+}