Check for failed allocation before using the pointer
Check for failed allocation of class-level buffer