init: fix memory leak in iscsi_create_context

iscsi instance is allocated in iscsi_create_context, after we return
NULL, nobody could handle it anymore.

Currently we can't hit this logic, anyway we still fix this.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
This commit is contained in:
zhenwei pi
2020-02-25 22:35:54 +08:00
parent 6ea30aea50
commit a391176a6d

View File

@@ -218,7 +218,7 @@ iscsi_create_context(const char *initiator_name)
/* initalize transport of context */
if (iscsi_init_transport(iscsi, TCP_TRANSPORT)) {
iscsi_set_error(iscsi, "Failed allocating transport");
free(iscsi);
return NULL;
}