Fix dereference of null pointer which Clang Static Analyser pointed out.
Fix garbag return value which Clang Static Analyser pointed out.