fix leaks (#7502)