astCallocastCalloc - Allocate and initialise memory

Description:
This function allocates memory in a similar manner to the standard C "calloc" function, but with improved security (against memory leaks, etc.) and with error reporting. It also fills the allocated memory with zeros.

Like astMallocastMalloc, it allows zero-sized memory allocation (without error), resulting in a NULL returned pointer value.

Synopsis:
void $*$astCalloc( size_t nmemb, size_t size )
Parameters:
nmemb
The number of array elements for which memory is to be allocated.
size
The size of each array element, in bytes.
Returned Value:
astCalloc()
If successful, the function returns a pointer to the start of the allocated memory region. If the size allocated is zero, this will be a NULL pointer.
Notes:
  • A pointer value of NULL is returned if this function is invoked with the global error status set or if it fails for any reason.