tests/pkg_cn-cbor: Use memarray_calloc for allocations

This commit is contained in:
Koen Zandberg 2020-09-02 19:22:08 +02:00
parent 232237796a
commit e7d907ce93
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B

View File

@ -58,12 +58,10 @@ static cn_cbor_context ct =
static void *cbor_calloc(size_t count, size_t size, void *memblock) static void *cbor_calloc(size_t count, size_t size, void *memblock)
{ {
(void)count; (void)count;
(void)size;
expect(count == 1); /* Count is always 1 with cn-cbor */ expect(count == 1); /* Count is always 1 with cn-cbor */
void *block = memarray_alloc(memblock); expect(size == sizeof(cn_cbor));
if (block) { return memarray_calloc(memblock);
memset(block, 0, size);
}
return block;
} }
static void cbor_free(void *ptr, void *memblock) static void cbor_free(void *ptr, void *memblock)