nvme/nvme_rdma: free the ctrlr when creating the qpair fails

Release nvme rdma ctrlr before exit the nvme_rdma_ctrlr_construct function
when creating the admin qpair fails.

Fixes GitHub issue #363.

Change-Id: Ib988e0da2f627db06b68bd3fb72c117c52572cf8
Signed-off-by: Chen Wang <chenx.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/420719
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Chen Wang 2018-07-30 10:17:27 +08:00 committed by Jim Harris
parent 6779479067
commit ea55b03940

View File

@ -1105,7 +1105,7 @@ struct spdk_nvme_ctrlr *nvme_rdma_ctrlr_construct(const struct spdk_nvme_transpo
rc = nvme_ctrlr_construct(&rctrlr->ctrlr);
if (rc != 0) {
nvme_ctrlr_destruct(&rctrlr->ctrlr);
free(rctrlr);
return NULL;
}
@ -1113,6 +1113,7 @@ struct spdk_nvme_ctrlr *nvme_rdma_ctrlr_construct(const struct spdk_nvme_transpo
SPDK_NVMF_MIN_ADMIN_QUEUE_ENTRIES, 0, SPDK_NVMF_MIN_ADMIN_QUEUE_ENTRIES);
if (!rctrlr->ctrlr.adminq) {
SPDK_ERRLOG("failed to create admin qpair\n");
nvme_rdma_ctrlr_destruct(&rctrlr->ctrlr);
return NULL;
}