Skip to content

Commit bd4b2da

Browse files
committed
dma-trace: avoid multiple allocations to fix fuzzy IPC
The fuzzy IPC testing reports there is memory leak if dma_trace_config IPC is sent multiple times, we should just return if the DMA trace buffer is already allocated, to avoid allocating new buffers and the leakage of the old buffers. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
1 parent 42ab3bd commit bd4b2da

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/trace/dma-trace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ int dma_trace_enable(struct dma_trace_data *d)
407407
{
408408
int err;
409409

410+
/* the existence of the trace buffer means the dma trace already initialized */
411+
if (d->dmatb.addr)
412+
return 0;
413+
410414
/* initialize dma trace buffer */
411415
err = dma_trace_buffer_init(d);
412416

0 commit comments

Comments
 (0)