From 4408fe3a62f0c52c5fe021fe1e85252e6c199346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=9F=E6=B0=91?= Date: Wed, 18 May 2022 13:34:48 +0800 Subject: [PATCH] fix the bug that free the resoruces while the exception return NULL. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张伟民 --- standard/appspawn_service.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index dfd7f994..32e106fd 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -503,7 +503,9 @@ AppSpawnContent *AppSpawnCreateContent(const char *socketName, char *longProcNam return NULL, "Failed to create socket for %s", path); // create socket ret = chmod(path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - APPSPAWN_CHECK(ret == 0, free(appSpawnContent); + APPSPAWN_CHECK(ret == 0, + LE_CloseStreamTask(LE_GetDefaultLoop(), &appSpawnContent->server); + free(appSpawnContent); return NULL, "Failed to chmod %s, err %d. ", path, errno); APPSPAWN_LOGI("AppSpawnCreateContent path %s fd %d", path, LE_GetSocketFd(appSpawnContent->server)); } -- Gitee