fix memory leak
Merge pull request #3634 from minggo/develop

fix memory leak