Fix issues detected by static analysis tool 45/229545/2
authorInHong Han <inhong1.han@samsung.com>
Thu, 2 Apr 2020 01:24:12 +0000 (10:24 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 2 Apr 2020 01:26:36 +0000 (10:26 +0900)
Change-Id: Ifcb7aa13ba2158b11687d77c04a3fdea6fe69219

sticker-parser/sticker-parser.c

index 2c3eb73..21debd2 100644 (file)
@@ -543,7 +543,7 @@ static int __get_sticker_info_from_json(const char *appid, const char *file_path
     char *uri = NULL;
     char *group = NULL;
     char *description = NULL;
-    char *thumbnail = NULL;
+    char *thumbnail_path = NULL;
     char *uri_path = NULL;
 
     parser = json_parser_new();
@@ -598,10 +598,10 @@ static int __get_sticker_info_from_json(const char *appid, const char *file_path
             if (!group)
                 goto free_memory;
 
-            thumbnail = __get_string_from_object(info_object, "thumbnail");
-            if (thumbnail) {
-                free(thumbnail);
-                thumbnail = __convert_sticker_uri(thumbnail, appid, app_path);
+            char *rel_thumbnail = __get_string_from_object(info_object, "thumbnail");
+            if (rel_thumbnail) {
+                thumbnail_path = __convert_sticker_uri(rel_thumbnail, appid, app_path);
+                free(rel_thumbnail);
             }
 
             description = __get_string_from_object(info_object, "description");
@@ -617,7 +617,7 @@ static int __get_sticker_info_from_json(const char *appid, const char *file_path
                     char *new_uri = __convert_sticker_uri(uri, appid, app_path);
                     if (!new_uri)
                         goto free_memory;
-                    __insert_sticker_info(appid, type, new_uri, group, thumbnail, description, disp_type);
+                    __insert_sticker_info(appid, type, new_uri, group, thumbnail_path, description, disp_type);
 
                     if (new_uri) {
                         free(new_uri);
@@ -643,7 +643,7 @@ static int __get_sticker_info_from_json(const char *appid, const char *file_path
                             uri_path = NULL;
                             goto free_memory;
                         }
-                        __insert_sticker_info(appid, type, new_uri, group, thumbnail, description, disp_type);
+                        __insert_sticker_info(appid, type, new_uri, group, thumbnail_path, description, disp_type);
 
                         free(new_uri);
                         new_uri = NULL;
@@ -658,7 +658,7 @@ static int __get_sticker_info_from_json(const char *appid, const char *file_path
                     }
                 }
             } else {
-                __insert_sticker_info(appid, type, uri, group, thumbnail, description, disp_type);
+                __insert_sticker_info(appid, type, uri, group, thumbnail_path, description, disp_type);
             }
 
             for (int j = 0; j < keyword_arr_len; j++) {
@@ -676,9 +676,9 @@ free_memory:
                 group = NULL;
             }
 
-            if (thumbnail) {
-                free(thumbnail);
-                thumbnail = NULL;
+            if (thumbnail_path) {
+                free(thumbnail_path);
+                thumbnail_path = NULL;
             }
 
             if (description) {