[core] memory leak prevention