mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
Merge pull request #11245 from gschorcht/tests/malloc/fix
tests/malloc: fix of dereferencing a NULL pointer
This commit is contained in:
commit
afa261194b
@ -38,8 +38,10 @@ void fill_memory(struct node *head)
|
||||
printf("Allocated %d Bytes at 0x%p, total %d\n", CHUNK_SIZE, head->ptr, total += CHUNK_SIZE);
|
||||
memset(head->ptr, '@', CHUNK_SIZE);
|
||||
head = head->next = malloc(sizeof(struct node));
|
||||
head->ptr = 0;
|
||||
head->next = 0;
|
||||
if (head) {
|
||||
head->ptr = 0;
|
||||
head->next = 0;
|
||||
}
|
||||
total += sizeof(struct node);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user