diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2019-05-06 15:18:54 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-05-09 19:52:55 -0400 |
commit | 28b4ba94811122d7a91924f62d63d8b25bfa979c (patch) | |
tree | f800895abe54e8fdd9b3492b53181e7e7c026f58 /drivers | |
parent | 3a90b50a32b6b8a2d66dc10c19e3c15d5bd1a092 (diff) |
ata: ahci: fix memory leak
malloc(..) and memalign(..) are both allocating memory and as a result
we leak the memory allocated with malloc(..).
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/ahci.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5fafb63aeb..188d843197 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -571,15 +571,12 @@ static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port) return -1; } - mem = malloc(AHCI_PORT_PRIV_DMA_SZ + 2048); + mem = memalign(2048, AHCI_PORT_PRIV_DMA_SZ); if (!mem) { free(pp); printf("%s: No mem for table!\n", __func__); return -ENOMEM; } - - /* Aligned to 2048-bytes */ - mem = memalign(2048, AHCI_PORT_PRIV_DMA_SZ); memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ); /* |