Fix memory leak (issue #7)