Don't dereference NULL when realloc() fails