Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b6271a6 authored by Valentin Ilie's avatar Valentin Ilie Committed by Vinod Koul
Browse files

dma: edma: Fix memory leak



When it fails to allocate a slot, edesc should be free'd before return;

Signed-off-by: default avatarValentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 18ebd564
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -305,6 +305,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
				edma_alloc_slot(EDMA_CTLR(echan->ch_num),
				edma_alloc_slot(EDMA_CTLR(echan->ch_num),
						EDMA_SLOT_ANY);
						EDMA_SLOT_ANY);
			if (echan->slot[i] < 0) {
			if (echan->slot[i] < 0) {
				kfree(edesc);
				dev_err(dev, "Failed to allocate slot\n");
				dev_err(dev, "Failed to allocate slot\n");
				kfree(edesc);
				kfree(edesc);
				return NULL;
				return NULL;