To prevent a NULL pointer dereference on a memory constrained system, check if malloc() was actually successful.