diff options
author | Maurizio Lombardi <mlombard@redhat.com> | 2015-10-01 04:56:25 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-02-23 21:27:02 -0500 |
commit | 0c88740dd2070b9af924ab092d5992ece6d90f4c (patch) | |
tree | ea572ecf5db72b0c765467ca61ba7ccbadd745eb /drivers/scsi/be2iscsi/be_main.c | |
parent | a230c2f6363c3fee8b6280b0732d7eb17554a4ca (diff) |
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 <mlombard@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_main.c')
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) | |||
2726 | phwi_ctrlr->wrb_context = kzalloc(sizeof(struct hwi_wrb_context) * | 2726 | phwi_ctrlr->wrb_context = kzalloc(sizeof(struct hwi_wrb_context) * |
2727 | phba->params.cxns_per_ctrl, | 2727 | phba->params.cxns_per_ctrl, |
2728 | GFP_KERNEL); | 2728 | GFP_KERNEL); |
2729 | if (!phwi_ctrlr->wrb_context) | 2729 | if (!phwi_ctrlr->wrb_context) { |
2730 | kfree(phba->phwi_ctrlr); | ||
2730 | return -ENOMEM; | 2731 | return -ENOMEM; |
2732 | } | ||
2731 | 2733 | ||
2732 | phba->init_mem = kcalloc(SE_MEM_MAX, sizeof(*mem_descr), | 2734 | phba->init_mem = kcalloc(SE_MEM_MAX, sizeof(*mem_descr), |
2733 | GFP_KERNEL); | 2735 | GFP_KERNEL); |