fix memory leak on uncaught error
Merge pull request #32 from wawjr3d/bugfix/memory_leak_on_uncaught_error

fix memory leak on uncaught error