summaryrefslogtreecommitdiffstats
path: root/drivers/dma/edma.c
diff options
context:
space:
mode:
authorValentin Ilie <valentin.ilie@gmail.com>2013-10-24 15:14:22 +0200
committerVinod Koul <vinod.koul@intel.com>2013-10-24 18:46:15 +0200
commit4b6271a64463f4fcbaf8b2e1d84704b7eb8c407c (patch)
treefed7c03ad0ff015ade5f52ad273580656788b57f /drivers/dma/edma.c
parentMAINTAINERS: add to ioatdma maintainer list (diff)
downloadlinux-4b6271a64463f4fcbaf8b2e1d84704b7eb8c407c.tar.xz
linux-4b6271a64463f4fcbaf8b2e1d84704b7eb8c407c.zip
dma: edma: Fix memory leak
When it fails to allocate a slot, edesc should be free'd before return; Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to '')
-rw-r--r--drivers/dma/edma.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 3519111c566b..134fa96de1b3 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -305,6 +305,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
edma_alloc_slot(EDMA_CTLR(echan->ch_num),
EDMA_SLOT_ANY);
if (echan->slot[i] < 0) {
+ kfree(edesc);
dev_err(dev, "Failed to allocate slot\n");
kfree(edesc);
return NULL;