aboutsummaryrefslogtreecommitdiff
path: root/crypto/x509/x_name.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-09-03 11:33:34 -0400
committerRich Salz <rsalz@openssl.org>2017-09-07 16:01:07 -0400
commit180794c54e98ae467c4ebced3737e1ede03e320a (patch)
tree9bce55454c67c1ed4117ad16522b43beded42458 /crypto/x509/x_name.c
parent511fbc60d4b6ab5b4ab3a7ad79be6abe898189da (diff)
downloadopenssl-180794c54e98ae467c4ebced3737e1ede03e320a.zip
openssl-180794c54e98ae467c4ebced3737e1ede03e320a.tar.gz
openssl-180794c54e98ae467c4ebced3737e1ede03e320a.tar.bz2
Fix error handling/cleanup
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4326)
Diffstat (limited to 'crypto/x509/x_name.c')
-rw-r--r--crypto/x509/x_name.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/crypto/x509/x_name.c b/crypto/x509/x_name.c
index 665a520..d36a9d3 100644
--- a/crypto/x509/x_name.c
+++ b/crypto/x509/x_name.c
@@ -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) {
- X509_NAME_free(*xn);
- *xn = in;
- }
- }
- return (*xn != NULL);
+ if ((name = X509_NAME_dup(name)) == NULL)
+ return 0;
+ X509_NAME_free(*xn);
+ *xn = name;
+ return 1;
}
int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)