From 876471dd5f82ad676441a7340035cc110fbfcc6d Mon Sep 17 00:00:00 2001 From: PengZheng Date: Sun, 28 Jan 2024 21:59:53 +0800 Subject: [PATCH] Fix stack-use-after-scope reported by clang build. `rpcArgs` refers to stack variables, which must be declared before `rpcArgs`. --- libs/dfi/src/json_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/dfi/src/json_rpc.c b/libs/dfi/src/json_rpc.c index b744b4e4e..d6547be9c 100644 --- a/libs/dfi/src/json_rpc.c +++ b/libs/dfi/src/json_rpc.c @@ -122,9 +122,9 @@ int jsonRpc_call(const dyn_interface_type* intf, void* service, const char* requ celix_err_pushf("Too many arguments for %s: %d > %d", sig, nrOfArgs, CELIX_JSON_RPC_MAX_ARGS); return ERROR; } - celix_auto(celix_rpc_args_t) rpcArgs = { dynArgs, {0} }; void* ptr = NULL; void* ptrToPtr = &ptr; + celix_auto(celix_rpc_args_t) rpcArgs = { dynArgs, {0} }; rpcArgs.args[0] = &serv->handle; --nrOfArgs;