Fix error handling/cleanup
@@ -473,19 +473,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;
}
int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
