hevc/main: fix exectuable and mem leaks