Remove unnecessary variable 59/229559/2
authorInHong Han <inhong1.han@samsung.com>
Thu, 2 Apr 2020 01:58:28 +0000 (10:58 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 2 Apr 2020 02:07:49 +0000 (02:07 +0000)
Change-Id: I8e745998dfe86181d30f7ac995081c448dff05f4

sticker-parser/sticker-parser.c

index 21debd2..86ebd3e 100644 (file)
@@ -348,21 +348,17 @@ cleanup:
     return ret;
 }
 
-static char* __convert_sticker_uri(const char *uri, const char *appid, const char *app_path)
+static char* __convert_sticker_uri(char *uri, const char *appid, const char *app_path)
 {
     int ret;
-    char *rel_path = strdup(uri);
 
-    __remove_app_path(rel_path, app_path);
-    int len = strlen(STICKER_DIRECTORY) + strlen(appid) + strlen(rel_path) + 2;
+    __remove_app_path(uri, app_path);
+    int len = strlen(STICKER_DIRECTORY) + strlen(appid) + strlen(uri) + 2;
     char *new_path = (char *)calloc(len, sizeof(char));
-    if (new_path == NULL) {
-        free(rel_path);
-        rel_path = NULL;
+    if (new_path == NULL)
         return NULL;
-    }
 
-    snprintf(new_path, len, "%s/%s%s",STICKER_DIRECTORY, appid, rel_path);
+    snprintf(new_path, len, "%s/%s%s",STICKER_DIRECTORY, appid, uri);
 
     if (access(new_path, F_OK) == 0) {
         LOGE("sticker file already exists");
@@ -393,9 +389,6 @@ static char* __convert_sticker_uri(const char *uri, const char *appid, const cha
         LOGE("failed to change ownership");
 
 cleanup:
-    free(rel_path);
-    rel_path = NULL;
-
     if (ret == 0) {
         return new_path;
     } else {