linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maurizio Lombardi <mlombard@redhat.com>
To: linux-scsi@vger.kernel.org
Cc: jayamohan.kallickal@avagotech.com, minh.tran@avagotech.com,
	sony.john-n@avagotech.com, James.Bottomley@HansenPartnership.com
Subject: [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem()
Date: Thu,  1 Oct 2015 10:56:25 +0200	[thread overview]
Message-ID: <1443689785-13712-1-git-send-email-mlombard@redhat.com> (raw)

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


             reply	other threads:[~2015-10-01  8:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01  8:56 Maurizio Lombardi [this message]
2016-02-10 10:13 ` [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443689785-13712-1-git-send-email-mlombard@redhat.com \
    --to=mlombard@redhat.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=jayamohan.kallickal@avagotech.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=minh.tran@avagotech.com \
    --cc=sony.john-n@avagotech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).