fix double free
Merge pull request #3 from yihuang/nds-unstable

fix double free