OSDN Git Service

dma: edma: Fix memory leak
authorValentin Ilie <valentin.ilie@gmail.com>
Thu, 24 Oct 2013 13:14:22 +0000 (16:14 +0300)
committerVinod Koul <vinod.koul@intel.com>
Thu, 24 Oct 2013 16:46:15 +0000 (22:16 +0530)
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>
drivers/dma/edma.c

index 3519111..134fa96 100644 (file)
@@ -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;