Various fixes for CppCheck warnings.

Hi,
in this pull request there are few various fixes for CppCheck warnings.

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>