Skip to content

Commit d5a88d2

Browse files
Jyri Sarhakv2019i
authored andcommitted
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 e3afad3 commit d5a88d2

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
@@ -211,6 +211,9 @@ static int teardown_test_case(void **state)
211211
struct test_data *td = *((struct test_data **)state);
212212
int i;
213213

214+
rfree(td->mod->input_buffers);
215+
rfree(td->mod->output_buffers);
216+
214217
for (i = 0; i < MUX_MAX_STREAMS; ++i)
215218
free_test_source(td->sources[i]);
216219

@@ -357,8 +360,10 @@ int main(void)
357360
cmocka_set_message_output(CM_OUTPUT_TAP);
358361
ret = cmocka_run_group_tests(tests, setup_group, NULL);
359362

360-
for (ti = 0; ti < ARRAY_SIZE(valid_formats) * ARRAY_SIZE(masks); ti++)
363+
for (ti = 0; ti < ARRAY_SIZE(valid_formats) * ARRAY_SIZE(masks); ti++) {
361364
free(tests[ti].initial_state);
365+
free((void *)tests[ti].name);
366+
}
362367

363368
return ret;
364369
}

0 commit comments

Comments
 (0)