Skip to content

Commit

Permalink
dma: edma: Fix memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vilie authored and Vinod Koul committed Oct 24, 2013
1 parent 18ebd56 commit 4b6271a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/dma/edma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4b6271a

Please sign in to comment.