Fixed static analyzer errors to do with not checking error parameters for NULL values.