Fix memory leak

zerofree: We should clean up the allocated memory when we finish or when we
encounter an error.

Signed-off-by: Tuan T. Pham <tuan@vt.edu>