Skip to content

Commit

Permalink
Fix stack-use-after-scope reported by clang build.
Browse files Browse the repository at this point in the history
`rpcArgs` refers to stack variables, which must be declared before `rpcArgs`.
  • Loading branch information
PengZheng committed Jan 28, 2024
1 parent 51f0f1d commit 876471d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/dfi/src/json_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 876471d

Please sign in to comment.