dma-trace: Fix memory leak of host elem_array on reconfiguration

When the dtrace is disabled (via the SOF_IPC_TRACE_DMA_FREE IPC message) we
need to also free up the allocated dma_sg_elem_array to avoid leaking
memory on the next dtrace start.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
This commit is contained in:
Peter Ujfalusi 2022-02-17 14:27:21 +02:00 committed by Liam Girdwood
parent e11673258c
commit 9c3452330d
1 changed files with 8 additions and 0 deletions

View File

@ -506,6 +506,14 @@ void dma_trace_disable(struct dma_trace_data *d)
/* free trace buffer */
dma_trace_buffer_free(d);
#if (CONFIG_HOST_PTABLE)
/* Free up the host SG if it is set */
if (d->host_size) {
dma_sg_free(&d->config.elem_array);
d->host_size = 0;
}
#endif
}
/** Sends all pending DMA messages to mailbox (for emergencies) */