reallocN

fnvoid * reallocN(void * mem, size_t nBlocks, size_t nBlockBytes)

This function is similar to [glib.global.realloc], allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

If the allocation fails (because the system is out of memory), the program is terminated.

Parameters

memthe memory to reallocate
nBlocksthe number of blocks to allocate
nBlockBytesthe size of each block in bytes

Returns

the new address of the allocated memory