Should always set the pointer to NULL to avoid corner case on malloc failure