Fix bug memory leaks
Merge pull request #345 from dreamsxin/phql

Fix bug memory leaks