Fix memory leaks
Refactoring
Add clang annotation
Merge pull request #3 from questbeat/master

Fix memory leaks and suppress compiler warnings