From d1156f9dc8c8509c2074286dd4bd4ad769f1de18 Mon Sep 17 00:00:00 2001 From: wangfeng Date: Thu, 15 Aug 2024 21:46:18 +0800 Subject: [PATCH] fix:memory leak Signed-off-by: wangfeng --- modules/sandbox/appspawn_sandbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/sandbox/appspawn_sandbox.c b/modules/sandbox/appspawn_sandbox.c index 3534d53b..edf8af55 100644 --- a/modules/sandbox/appspawn_sandbox.c +++ b/modules/sandbox/appspawn_sandbox.c @@ -209,7 +209,7 @@ static int InitSandboxContext(SandboxContext *context, if (permissionNode == NULL) { return -1; } - context->sandboxShared = packageNode->section.sandboxShared; + context->sandboxShared = permissionNode->section.sandboxShared; node = node->next; } @@ -524,7 +524,7 @@ static bool IsUnlockStatus(uint32_t uid) char *path = (char *)malloc(sizeof(char) * allPathSize); APPSPAWN_CHECK(path != NULL, return true, "Failed to malloc path"); int len = sprintf_s(path, allPathSize, "%s%u%s", rootPath, uid, basePath); - APPSPAWN_CHECK(len > 0 && ((size_t)len < allPathSize), return true, "Failed to get base path"); + APPSPAWN_CHECK(len > 0 && ((size_t)len < allPathSize), free(path); return true, "Failed to get base path"); if (access(path, F_OK) == 0) { APPSPAWN_LOGI("this is unlock status");