mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
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>
This commit is contained in:
committed by
Tom Rini
parent
3a90b50a32
commit
28b4ba9481
@@ -571,15 +571,12 @@ static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mem = malloc(AHCI_PORT_PRIV_DMA_SZ + 2048);
|
mem = memalign(2048, AHCI_PORT_PRIV_DMA_SZ);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
free(pp);
|
free(pp);
|
||||||
printf("%s: No mem for table!\n", __func__);
|
printf("%s: No mem for table!\n", __func__);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Aligned to 2048-bytes */
|
|
||||||
mem = memalign(2048, AHCI_PORT_PRIV_DMA_SZ);
|
|
||||||
memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ);
|
memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user