lib/iscsi: fix possible memory leak.

If we fail to allocate all of the params, we should free
the ones we did.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I0f0be6320b27211e3713d9b79b5a0b0ed103e7d2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2007
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Seth Howell 2020-04-23 17:02:28 -07:00 committed by Tomasz Zawadzki
parent e5c4b63382
commit d09be67d3f

View File

@ -1342,6 +1342,7 @@ iscsi_op_login_store_incoming_params(struct spdk_iscsi_conn *conn,
&conn->partial_text_parameter);
if (rc < 0) {
SPDK_ERRLOG("iscsi_parse_params() failed\n");
iscsi_param_free(*params);
rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;
rsph->status_detail = ISCSI_LOGIN_INITIATOR_ERROR;
return SPDK_ISCSI_LOGIN_ERROR_PARAMETER;