[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161125122351.8226-1-lambert.quentin@gmail.com>
Date: Fri, 25 Nov 2016 13:23:51 +0100
From: Quentin Lambert <lambert.quentin@...il.com>
To: "James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org, thenzl@...hat.com
Cc: Quentin Lambert <lambert.quentin@...il.com>
Subject: [PATCH v2] scsi: aic94xx: Add a missing call to kfree
Most error branches following the call to kzalloc contain
a call to kfree. This patch add these calls where they are
missing and set the relevant pointers to NULL.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@...il.com>
---
v2: set the point to NULL after having freed it
drivers/scsi/aic94xx/aic94xx_hwi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -228,8 +228,11 @@ static int asd_init_scbs(struct asd_ha_s
bitmap_bytes = (asd_ha->seq.tc_index_bitmap_bits+7)/8;
bitmap_bytes = BITS_TO_LONGS(bitmap_bytes*8)*sizeof(unsigned long);
asd_ha->seq.tc_index_bitmap = kzalloc(bitmap_bytes, GFP_KERNEL);
- if (!asd_ha->seq.tc_index_bitmap)
+ if (!asd_ha->seq.tc_index_bitmap) {
+ kfree(asd_ha->seq.tc_index_array);
+ asd_ha->seq.tc_index_array = NULL;
return -ENOMEM;
+ }
spin_lock_init(&seq->tc_index_lock);
Powered by blists - more mailing lists