Skip to content

Commit 21db7d4

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

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
@@ -188,6 +188,9 @@ static int teardown_test_case(void **state)
188188
struct test_data *td = *((struct test_data **)state);
189189
int i;
190190

191+
rfree(td->mod->input_buffers);
192+
rfree(td->mod->output_buffers);
193+
191194
free_test_source(td->source);
192195

193196
for (i = 0; i < MUX_MAX_STREAMS; ++i)
@@ -339,8 +342,10 @@ int main(void)
339342
cmocka_set_message_output(CM_OUTPUT_TAP);
340343
ret = cmocka_run_group_tests(tests, setup_group, NULL);
341344

342-
for (ti = 0; ti < ARRAY_SIZE(valid_formats) * ARRAY_SIZE(masks); ti++)
345+
for (ti = 0; ti < ARRAY_SIZE(valid_formats) * ARRAY_SIZE(masks); ti++) {
343346
free(tests[ti].initial_state);
347+
free((void *)tests[ti].name);
348+
}
344349

345350
return ret;
346351
}

0 commit comments

Comments
 (0)