event: fix segv on json config read failure
If reading the JSON config file has failed, we entered spdk_app_json_config_load_done(-ERRNO) and tried to close a client connection that was never initiated, which resulted in NULL dereference. To fix it, just check if client_conn != NULL before attempting to close it. Change-Id: I7340567c45e795f77110c2914e94ba83fa8d1bff Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458350 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
7bf3ac17f7
commit
a7d9fc4a4d
@ -128,7 +128,10 @@ static void
|
||||
spdk_app_json_config_load_done(struct load_json_config_ctx *ctx, int rc)
|
||||
{
|
||||
spdk_poller_unregister(&ctx->client_conn_poller);
|
||||
spdk_jsonrpc_client_close(ctx->client_conn);
|
||||
if (ctx->client_conn != NULL) {
|
||||
spdk_jsonrpc_client_close(ctx->client_conn);
|
||||
}
|
||||
|
||||
spdk_rpc_finish();
|
||||
|
||||
if (rc) {
|
||||
|
Loading…
Reference in New Issue
Block a user