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

login
register
mail settings
Submitter Rob Herring
Date Aug. 24, 2013, 3:10 p.m.
Message ID <1377357054-27408-3-git-send-email-robherring2@gmail.com>
Download mbox | patch
Permalink /patch/269647/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Rob Herring - Aug. 24, 2013, 3:10 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>
Reviewed-by: Tom Rini <trini@ti.com>
---
v2: rebase to v2013.10-rc1

 drivers/block/ahci.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index f4d1d81..f088063 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -643,6 +643,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;
 	}