Fix some memory leaks.

v1.0.1