enh(ci): fix CppCheck warnings
Description
CppCheck, which was enabled in sight-git!46 (merged), discovered some problems in Sight code which I fixed with these changes. I have divided my MR with one commit for each detected warning, so that it should be easy to delete changes if one warning is considered irrelevant.
How to test it?
Launch all tests, they should all pass. Test the applications, there should be no regressions. Launch CppCheck, there should be no warnings.