[PATCH] drivers/scsi:fix memory leak

From: Heloise
Date: Mon May 16 2016 - 02:46:51 EST


In function ahc_handle_en_lun, variable lstate has not been
freed before return, which can cause memory leak, fix it.

Signed-off-by: Heloise <os@xxxxxxxxxxx>
---
drivers/scsi/aic7xxx/aic7xxx_core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 64ab9ea..e8fbdb5 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -7684,6 +7684,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)

if (ccb->ccb_h.status != CAM_REQ_CMP) {
ahc_unlock(ahc, &s);
+ kfree(lstate);
return;
}

--
2.1.0