Don't step off the end of the allocated buffer.
Free memory when done.