Skip to contentSkip to conversation

dma: edma.c: remove edma_desc leakage

PATCH In review Geyslan G. Bem 2 participants 2 messages Oct 7, 2013 – Oct 11, 2013 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma: edma.c: remove edma_desc leakage

Free memory allocated to edma_desc when failing to allocate slot.

---
 drivers/dma/edma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/edma.c +1 -0
index ff50ff4..3aab605 100644
@@ -306,6 +306,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
 						EDMA_SLOT_ANY);
 			if (echan->slot[i] < 0) {
 				dev_err(dev, "Failed to allocate slot\n");
+				kfree(edesc);
 				return NULL;
 			}
 		}
Signature · 1 line
1.8.4
#1 lore raw
Quoted 3 lines · Geyslan G. Bem

Free memory allocated to edma_desc when failing to allocate slot.

Applied thanks

~Vinod

Quoted 19 lines
---
 drivers/dma/edma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/edma.c +1 -0
index ff50ff4..3aab605 100644
@@ -306,6 +306,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
 						EDMA_SLOT_ANY);
 			if (echan->slot[i] < 0) {
 				dev_err(dev, "Failed to allocate slot\n");
+				kfree(edesc);
 				return NULL;
 			}
 		}
Signature · 1 line
1.8.4