From: Christian Gmeiner Date: Mon, 6 May 2019 13:18:54 +0000 (+0200) Subject: ata: ahci: fix memory leak X-Git-Tag: v2019.07-rc2~7^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28b4ba94811122d7a91924f62d63d8b25bfa979c;p=platform%2Fkernel%2Fu-boot.git 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 Reviewed-by: Simon Glass --- diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5fafb63..188d843 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); /*