Skip to content

Commit 865c461

Browse files
author
Jyri Sarha
committed
cmocka: demux_copy: Fix memory leaks
Fix all memory leaks found from demux_copy test when tests were run under Valgrind. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 66914d3 commit 865c461

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/cmocka/src/audio/mux/demux_copy.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ static int teardown_test_case(void **state)
180180
struct test_data *td = *((struct test_data **)state);
181181
int i;
182182

183+
rfree(td->mod->input_buffers);
184+
rfree(td->mod->output_buffers);
185+
183186
free_test_source(td->source);
184187

185188
for (i = 0; i < MUX_MAX_STREAMS; ++i)
@@ -329,8 +332,10 @@ int main(void)
329332
cmocka_set_message_output(CM_OUTPUT_TAP);
330333
ret = cmocka_run_group_tests(tests, setup_group, NULL);
331334

332-
for (ti = 0; ti < ARRAY_SIZE(valid_formats) * ARRAY_SIZE(masks); ti++)
335+
for (ti = 0; ti < ARRAY_SIZE(valid_formats) * ARRAY_SIZE(masks); ti++) {
333336
free(tests[ti].initial_state);
337+
free((void *)tests[ti].name);
338+
}
334339

335340
return ret;
336341
}

0 commit comments

Comments
 (0)