Bug #710997 - Check some return values before use

Check that some return values are not NULL before using them,
in functions that do not check, such as strcmp(), or before
dereferencing.