Revert "fix resource leak, coverity issue 1198844"

This reverts commit 3a1a51ac4676dde4170648e56778a5ec50a70279.