Core/Misc: Fix a couple of warnings, some of them performance related

Errors were found using Cppcheck, open-source static analysis tool