rpc: set g_jsonrpc_server to NULL on close

If the user calls spdk_rpc_close() multiple times, there would be a
double free.  This is not normally possible when using the SPDK event
framework RPC subsystem, since it will only call spdk_rpc_close() once,
but it doesn't hurt to make the RPC library public API handle this case.

Fixes GitHub issue #219.

Change-Id: I80cff0ed871dec6b90bd2658e85b0cd0914b6ada
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/389394
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Daniel Verkamp 2017-11-28 10:58:42 -07:00 committed by Jim Harris
parent 6802fe99f4
commit 1c4bdde9a4

View File

@ -182,6 +182,7 @@ spdk_rpc_close(void)
}
spdk_jsonrpc_server_shutdown(g_jsonrpc_server);
g_jsonrpc_server = NULL;
}
}