1
0
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:
Alexandre Abadie 2019-03-25 08:40:24 +01:00 committed by GitHub
commit afa261194b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
}