Fix error handling/cleanup

(Imported from upstream's 4d2df46cb38603c98fb49543738289c9176571d8.)

Change-Id: I62e5d6fa58c57c4f5d30d00baf14f2024278c1de
Reviewed-on: https://boringssl-review.googlesource.com/20104
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Steven Valdez <svaldez@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
David Benjamin 2017-09-07 17:48:05 -04:00 committed by CQ bot account: commit-bot@chromium.org
parent b86be3617d
commit 769b386e97

View File

@ -526,19 +526,11 @@ static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) * _intname,
int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
{
X509_NAME *in;
if (!xn || !name)
return (0);
if (*xn != name) {
in = X509_NAME_dup(name);
if (in != NULL) {
if ((name = X509_NAME_dup(name)) == NULL)
return 0;
X509_NAME_free(*xn);
*xn = in;
}
}
return (*xn != NULL);
*xn = name;
return 1;
}
IMPLEMENT_ASN1_SET_OF(X509_NAME_ENTRY)