aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArmelle Laine <armellel@google.com>2022-10-22 06:25:34 +0000
committerArmelle Laine <armellel@google.com>2022-12-06 19:15:15 +0000
commit79d1ececbceb4f221d9c94368cc62546e731ee3f (patch)
tree96d0e78b390a940d057b48289d17c74f2edb2174 /lib
parentc9cbe7dc1027a2b974ca4424ccbae01a9b5e72e6 (diff)
downloadcommon-79d1ececbceb4f221d9c94368cc62546e731ee3f.tar.gz
lib: heap: miniheap: fix uninitialized variables
Bug: 252870906 Change-Id: I59b8f246e29ecead08ae653ce6e7cf9fc6101840
Diffstat (limited to 'lib')
-rw-r--r--lib/heap/miniheap/miniheap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/heap/miniheap/miniheap.c b/lib/heap/miniheap/miniheap.c
index 549afae4..4b03557c 100644
--- a/lib/heap/miniheap/miniheap.c
+++ b/lib/heap/miniheap/miniheap.c
@@ -122,6 +122,9 @@ static struct free_heap_chunk *heap_insert_free_chunk(struct free_heap_chunk *ch
theheap.remaining += chunk->len;
// walk through the list, finding the node to insert before
+ // note: next_chunk is initialized to NULL by list_for_every_entry macro
+ // both when next item is the last element (entry->next == list)
+ // or its content is empty.
list_for_every_entry(&theheap.free_list, next_chunk, struct free_heap_chunk, node) {
if (chunk < next_chunk) {
#if LK_DEBUGLEVEL > INFO