Skip to content

Commit 2ef1514

Browse files
committed
cmocka: fix valigrind leaks
Fix valgrind memory leak warnings by freeing resources. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 8e06e8b commit 2ef1514

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

test/cmocka/src/audio/pipeline/pipeline_connection_mocks.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "pipeline_connection_mocks.h"
99

1010
extern struct schedulers *schedulers;
11+
struct schedule_data *sch;
1112

1213
struct scheduler_ops schedule_mock_ops = {
1314
.schedule_task_free = &schedule_task_mock_free,
@@ -42,7 +43,7 @@ struct pipeline_connect_data *get_standard_connect_objects(void)
4243
schedulers = calloc(sizeof(struct schedulers), 1);
4344
list_init(&schedulers->list);
4445

45-
struct schedule_data *sch = calloc(sizeof(struct schedule_data), 1);
46+
sch = calloc(sizeof(struct schedule_data), 1);
4647

4748
list_init(&sch->list);
4849
sch->type = SOF_SCHEDULE_EDF;
@@ -93,4 +94,6 @@ void free_standard_connect_objects(struct pipeline_connect_data *data)
9394
free(data->second);
9495
free(data->b1);
9596
free(data->b2);
97+
free(sch);
98+
free(schedulers);
9699
}

test/cmocka/src/notifier_mocks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,6 @@ void notifier_unregister_all(void *receiver, void *caller)
9999

100100
for (i = 0; i < NOTIFIER_ID_COUNT; i++)
101101
notifier_unregister(receiver, caller, i);
102+
free(_notify);
103+
_notify = NULL;
102104
}

0 commit comments

Comments
 (0)