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");
LOGE("failed to change ownership");
cleanup:
- free(rel_path);
- rel_path = NULL;
-
if (ret == 0) {
return new_path;
} else {