fix memory leak
Merge pull request #136 from satta/memleak_fix

fix memory leak