Revert "fix potential memory leak"

This reverts commit 9a199270cf7c1f5a36e553fa0068ac535d39fd79.