[core] fix a small memory leak