ata: ahci: fix memory leak
PATCH 1/1 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 <[email protected]>
--- drivers/ata/ahci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/ata/ahci.c +1 -4
@@ -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 );/*
Signature · 1 line
2.21.0
PATCH 1/1 ata: ahci: fix memory leak
Quoted 9 lines · Christian Gmeiner
malloc(..) and memalign(..) are both allocating memory and as a result we leak the memory allocated with malloc(..).
Signed-off-by Christian Gmeiner <[email protected]>--- drivers/ata/ahci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Reviewed-by Simon Glass <[email protected]>
PATCH 1/1 ata: ahci: fix memory leak
In reply to Christian GmeinerQuoted 5 lines · Christian Gmeiner
malloc(..) and memalign(..) are both allocating memory and as a result we leak the memory allocated with malloc(..).
Signed-off-by Christian Gmeiner <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190510/3bdf2f3d/attachment.sig>