fix scan-build memory leaks
don't internally mutate likely_pkg
free more leaking memory