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:
parent
8056eafffd
commit
a6ceeec29f
@ -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++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user