From: Maurizio Lombardi Date: Thu, 1 Oct 2015 08:56:25 +0000 (+0200) Subject: be2iscsi: Fix memory leak in beiscsi_alloc_mem() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0c88740dd2070b9af924ab092d5992ece6d90f4c;p=openwrt%2Fstaging%2Fblogic.git be2iscsi: Fix memory leak in beiscsi_alloc_mem() In case of error, the memory allocated for phwi_ctrlr was not freed. Signed-off-by: Maurizio Lombardi Reviewed-by: Johannes Thumshirn Reviewed-by: Jitendra Bhivare Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 0892ee28463f..7243a80b0d6d 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -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);