Correction to issues identified via static analysis
More fixes for potential problems flagged by the Clang static analyser