tools: testbench: initialize pointer before freeing it

When we try to free a pointer which is not initialized, we are
using a value in the program which is undefined. So, initialize
the pointer variable, so that in future, when we free the pointer
it won't cause a problem.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
This commit is contained in:
Mohana Datta Yelugoti 2020-07-23 14:31:46 +00:00 committed by Liam Girdwood
parent 369e9e3b5a
commit b1dec44124
1 changed files with 3 additions and 0 deletions

View File

@ -734,6 +734,9 @@ int parse_topology(struct sof *sof, struct shared_lib_table *library_table,
temp_comp_list = (struct comp_info *)
realloc(temp_comp_list, size);
for (i = (num_comps - hdr->count); i < num_comps; i++)
temp_comp_list[i].name = NULL;
for (i = (num_comps - hdr->count); i < num_comps; i++) {
ret = load_widget(sof, SOF_DEV,
temp_comp_list,