diff --git a/services/sandbox/sandbox.c b/services/sandbox/sandbox.c index fb27356474d3db341a7fcee05236c0e25544eafc..9b24a74340192e1dea8d8ca4c68ac34f591f62ad 100755 --- a/services/sandbox/sandbox.c +++ b/services/sandbox/sandbox.c @@ -278,7 +278,7 @@ static int AddSymbolLinksToSandbox(sandbox_t *sandbox, cJSON *item, const char * tmpLink->target = strdup(target); BEGET_ERROR_CHECK(tmpLink->target != NULL, free(tmpLink); return -1, "Failed to dup target"); tmpLink->linkName = strdup(name); - BEGET_ERROR_CHECK(tmpLink->linkName != NULL, free(tmpLink); return -1, "Failed to dup linkName"); + BEGET_ERROR_CHECK(tmpLink->linkName != NULL, free(tmpLink->target); free(tmpLink); return -1, "Failed to dup linkName"); OH_ListInit(&tmpLink->node); RemoveOldSandboxLinkListNode(&sandbox->linksHead, tmpLink->linkName); OH_ListAddTail(&sandbox->linksHead, &tmpLink->node);