Removed unneeded free in ArrayResize, added NULL check against realloc.