Fix compiler and analyzer warnings