#### Description:

This function allocates memory in a similar manner to the standard C `"` malloc`"` function, but with improved security (against memory leaks, etc.) and with error reporting. It also allows zero-sized memory allocation (without error), resulting in a NULL returned pointer value.

#### Synopsis

void ∗astMalloc( size_t size )

#### Parameters:

##### size

The size of the memory region required (may be zero).

#### Returned Value

##### astMalloc()

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.

Copyright (C) 2021 East Asian Observatory