Various fixes for CppCheck warnings.

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>