Memory allocation cleanups.

- Remove previous optimization and just always malloc and free for each read.