Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c88740d authored by Maurizio Lombardi's avatar Maurizio Lombardi Committed by Martin K. Petersen
Browse files

be2iscsi: Fix memory leak in beiscsi_alloc_mem()



In case of error, the memory allocated for phwi_ctrlr was not freed.

Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarJitendra Bhivare <jitendra.bhivare@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a230c2f6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2726,8 +2726,10 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba)
	phwi_ctrlr->wrb_context = kzalloc(sizeof(struct hwi_wrb_context) *
					  phba->params.cxns_per_ctrl,
					  GFP_KERNEL);
	if (!phwi_ctrlr->wrb_context)
	if (!phwi_ctrlr->wrb_context) {
		kfree(phba->phwi_ctrlr);
		return -ENOMEM;
	}

	phba->init_mem = kcalloc(SE_MEM_MAX, sizeof(*mem_descr),
				 GFP_KERNEL);