From f039d017f8e39e00463789e74196cb11a074051d Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 2 Apr 2020 10:58:28 +0900 Subject: [PATCH] Remove unnecessary variable Change-Id: I8e745998dfe86181d30f7ac995081c448dff05f4 --- sticker-parser/sticker-parser.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/sticker-parser/sticker-parser.c b/sticker-parser/sticker-parser.c index 21debd2..86ebd3e 100644 --- a/sticker-parser/sticker-parser.c +++ b/sticker-parser/sticker-parser.c @@ -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 { -- 2.7.4