Fix a handful of minor leaks found by Coverity
These are all pretty minor, mostly leaks in error paths.
This is not comprehensive. I just looked over the first few dozen issues in Red Hat's latest Coverity report and fixed the ones that didn't look like false positives.