It's valid to pass a NULL pointer to realloc.

According to ANSI C it will behave like malloc. Take advantage of this
and save a few lines.