Fix a couple of NULL dereferences in error paths.