vhost: Handle failed memory allocation when dumping config

Change-Id: I929e2a668189c36a8837ce8cb8731e394bcb6d9a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/408238
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Ben Walker 2018-04-18 13:36:40 -07:00 committed by Jim Harris
parent b31d31b22b
commit aa345078c1

View File

@ -1391,7 +1391,13 @@ spdk_vhost_config_json_cb(struct spdk_vhost_dev *vdev, void *arg)
void
spdk_vhost_config_json(struct spdk_json_write_ctx *w, struct spdk_event *done_ev)
{
struct spdk_vhost_write_config_json_ctx *ctx = calloc(1, sizeof(*ctx));
struct spdk_vhost_write_config_json_ctx *ctx;
ctx = calloc(1, sizeof(*ctx));
if (!ctx) {
spdk_event_call(done_ev);
return;
}
ctx->w = w;
ctx->done_ev = done_ev;