Fix memory leak (issue #7)

Fix memory leak mentioned in issue #7