Patchwork [U-Boot,3/7] ahci: fix memory leak in ata_scsiop_inquiry

login
register
mail settings
Submitter Rob Herring
Date May 21, 2013, 10:44 p.m.
Message ID <1369176276-1895-3-git-send-email-robherring2@gmail.com>
Download mbox | patch
Permalink /patch/245442/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Rob Herring - May 21, 2013, 10:44 p.m.
From: Rob Herring <rob.herring@calxeda.com>

This fixes a memory leak when scsi inquiry fails.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/block/ahci.c | 1 +
 1 file changed, 1 insertion(+)
Tom Rini - May 24, 2013, 1:46 p.m.
On Tue, May 21, 2013 at 05:44:32PM -0500, Rob Herring wrote:

> From: Rob Herring <rob.herring@calxeda.com>
> 
> This fixes a memory leak when scsi inquiry fails.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>

Reviewed-by: Tom Rini <trini@ti.com>

Patch

diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index 3cb37e7..a2aa433 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -660,6 +660,7 @@  static int ata_scsiop_inquiry(ccb *pccb)
 	if (ahci_device_data_io(port, (u8 *) &fis, sizeof(fis), tmpid,
 				sizeof(hd_driveid_t), 0)) {
 		debug("scsi_ahci: SCSI inquiry command failure.\n");
+		free(tmpid);
 		return -EIO;
 	}