OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
allocateMemory.c
Go to the documentation of this file.
1 #include <genutils.h>
2 #include <stdlib.h>
3 
4 /* -----------------------------------------------------------------------
5  * allocate and zero out memory. Print decent error message.
6  * ----------------------------------------------------------------------- */
7 void* allocateMemory(size_t numBytes, const char* name) {
8  void* ptr = calloc(numBytes, 1);
9  if (ptr == NULL) {
10  printf("-E- %s line %d : error allocating memory for %s.\n",
11  __FILE__, __LINE__, name);
12  exit(1);
13  }
14  return ptr;
15 }
void * allocateMemory(size_t numBytes, const char *name)
Definition: allocateMemory.c:7
#define NULL
Definition: decode_rs.h:63