1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

ips/dma: fix memory leak in libxil code by explicitly calling free on

CyclicBd

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2024-02-10 16:21:03 +01:00 committed by Niklas Eiling
parent b0ccbddc6f
commit 1bb6c221f6

View file

@ -201,6 +201,18 @@ Dma::~Dma() {
// Unmap memory in our ownership, MemoryBlock gets deleted and removed from
// graph by this destructor as well.
if (hasScatterGather()) {
// Fix memory leak in upstream Xilinx code
auto txRingPtr = XAxiDma_GetTxRing(&xDma);
auto rxRingPtr = XAxiDma_GetRxRing(&xDma);
if (txRingPtr) {
free(txRingPtr->CyclicBd);
txRingPtr->CyclicBd = nullptr;
}
if (rxRingPtr) {
free(rxRingPtr->CyclicBd);
rxRingPtr->CyclicBd = nullptr;
}
// unampe SG memory Blocks
if (sgRingTx) {
card->unmapMemoryBlock(*sgRingTx);
}