Fix a failure to NULL a pointer freed on error.