Add missing line to return NULL when alloc failed.