Fix a few unlikely corner-case leaks

Fix a few leaks that can only happen in case of programming error.

Thanks to Pavel Roschin and his cppcheck for spotting them!