Use malloc() to allocate a new array, copy elements from the old array to the new one, and release the old array.

That is sort of pointless, since that achieves what realloc() does, except that...