MB-12613: clang analyzer fixes for null dereference, dead store etc

Change-Id: I71baac9cb49cca7473289dedfbc1c00f08fbc728