added utility to free one-dimensional array