linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem()
@ 2015-10-01  8:56 Maurizio Lombardi
  2016-02-10 10:13 ` Maurizio Lombardi
       [not found] ` <CAJRCtXfbT9OrVVDrnC=1V1B4iFUm+FHN4fxQV1CUCY3pXRHq2Q@mail.gmail.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Maurizio Lombardi @ 2015-10-01  8:56 UTC (permalink / raw)
  To: linux-scsi; +Cc: jayamohan.kallickal, minh.tran, sony.john-n, James.Bottomley

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

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7a6dbfb..360aa88 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2706,8 +2706,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);
-- 
Maurizio Lombardi


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-11 14:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01  8:56 [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem() Maurizio Lombardi
2016-02-10 10:13 ` Maurizio Lombardi
2016-02-10 11:07   ` Johannes Thumshirn
2016-02-10 17:23   ` Martin K. Petersen
     [not found] ` <CAJRCtXfbT9OrVVDrnC=1V1B4iFUm+FHN4fxQV1CUCY3pXRHq2Q@mail.gmail.com>
2016-02-11 12:59   ` Jitendra Bhivare
2016-02-11 14:34     ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).