From f250a07b4b89ff6fdf43cbfbbf6c2faf7bc488b3 Mon Sep 17 00:00:00 2001 From: stesen Date: Mon, 21 Mar 2022 11:30:37 +0800 Subject: [PATCH] fix malloc return judgment Signed-off-by: stesen Change-Id: Icbd605293c7045d6b53950fb15208bb0b6f3d37c --- porting/linux/user/src/hook/musl_preinit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/porting/linux/user/src/hook/musl_preinit.c b/porting/linux/user/src/hook/musl_preinit.c index 22918f0e..c719ac02 100644 --- a/porting/linux/user/src/hook/musl_preinit.c +++ b/porting/linux/user/src/hook/musl_preinit.c @@ -63,11 +63,11 @@ static char* get_native_hook_param() } const char *key = MUSL_HOOK_PARAM_NAME; char *value = (char *)malloc(OHOS_PARAM_MAX_SIZE); - memset(value, 0, OHOS_PARAM_MAX_SIZE); if (value == NULL) { dlclose(shared_library_handle); return NULL; } + memset(value, 0, OHOS_PARAM_MAX_SIZE); unsigned int len = OHOS_PARAM_MAX_SIZE; getFunction(key, value, &len); dlclose(shared_library_handle); -- GitLab