Avoid a null pointer deref on a malloc failure