Core/Misc: Another batch of fixes for issues found by static analysis