Fix memory leak.

Fixes #5.

Thanks go out to Hiroshi Shirosaki and Jon Forums from TheCodeShop forum at https://groups.google.com/forum/?fromgroups=#!topic/thecodeshop/74n1P4_dSLg