1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

tests/malloc: fix counting bug

There is a corner cases in which the counting of allocated memory
previously was wrong: When the allocation of the chunk succeeded but the
allocation of the next struct  node fails. This was relatively unlikely
to happen, as the chunk size was much bigger than the memory required by
the struct node. But it happens on the ESP32 boards resulting in failing
nightlies. This fixes the issue.
This commit is contained in:
Marian Buschsieweke 2021-12-02 14:07:01 +01:00
parent 8056eafffd
commit a6ceeec29f
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -84,7 +84,7 @@ static void free_memory(struct node *head)
while (head) {
if (head->ptr) {
if (total > CHUNK_SIZE) {
if (total >= CHUNK_SIZE) {
total -= CHUNK_SIZE;
freed++;
}