nvmf: fix the error handling in spdk_nvmf_session_connect

We need to free the session resource, if there is error
for creating a new session

Change-Id: I7c4f3e779e0b30e213e02b8676d93bd2fe9bf851
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2016-09-12 15:31:17 +08:00 committed by Daniel Verkamp
parent bc0867dcaf
commit e8be2f64d7

View File

@ -264,6 +264,9 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn,
session->max_connections_allowed = g_nvmf_tgt.max_queues_per_session;
if (conn->transport->session_init(session, conn)) {
rsp->status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
conn->transport->session_fini(session);
free(session);
subsystem->session = NULL;
return;
}