iscsi: fix double free when failed to start target

When iSCSI target failed to start due to insuccificent resource like PDU pool,
one memory is double freed.

Change-Id: I1b68d4f0f130b024be9f8406c8d1611e92a27787
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453981
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
GangCao 2019-05-10 18:15:45 -04:00 committed by Changpeng Liu
parent 9602ade769
commit e358eaeeea

View File

@ -1308,6 +1308,7 @@ iscsi_parse_globals(void)
if (rc != 0) { if (rc != 0) {
SPDK_ERRLOG("spdk_initialize_all_pools() failed\n"); SPDK_ERRLOG("spdk_initialize_all_pools() failed\n");
free(g_spdk_iscsi.session); free(g_spdk_iscsi.session);
g_spdk_iscsi.session = NULL;
return -1; return -1;
} }
@ -1315,6 +1316,7 @@ iscsi_parse_globals(void)
if (rc < 0) { if (rc < 0) {
SPDK_ERRLOG("spdk_initialize_iscsi_conns() failed\n"); SPDK_ERRLOG("spdk_initialize_iscsi_conns() failed\n");
free(g_spdk_iscsi.session); free(g_spdk_iscsi.session);
g_spdk_iscsi.session = NULL;
return rc; return rc;
} }