Skip to content

Commit 66914d3

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

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

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

206+
rfree(td->mod->input_buffers);
207+
rfree(td->mod->output_buffers);
208+
206209
for (i = 0; i < MUX_MAX_STREAMS; ++i)
207210
free_test_source(td->sources[i]);
208211

@@ -347,8 +350,10 @@ int main(void)
347350
cmocka_set_message_output(CM_OUTPUT_TAP);
348351
ret = cmocka_run_group_tests(tests, setup_group, NULL);
349352

350-
for (ti = 0; ti < ARRAY_SIZE(valid_formats) * ARRAY_SIZE(masks); ti++)
353+
for (ti = 0; ti < ARRAY_SIZE(valid_formats) * ARRAY_SIZE(masks); ti++) {
351354
free(tests[ti].initial_state);
355+
free((void *)tests[ti].name);
356+
}
352357

353358
return ret;
354359
}

0 commit comments

Comments
 (0)