From: Rich Salz Date: Sun, 3 Sep 2017 15:33:34 +0000 (-0400) Subject: Fix error handling/cleanup X-Git-Tag: OpenSSL_1_1_0g~74 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4ea5f53d7c6364d3d91539258d8aeb6e9a2e4c93;p=oweals%2Fopenssl.git Fix error handling/cleanup Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/4326) (cherry picked from commit 180794c54e98ae467c4ebced3737e1ede03e320a) --- diff --git a/crypto/x509/x_name.c b/crypto/x509/x_name.c index 97d735f8f2..0af5df5cfc 100644 --- a/crypto/x509/x_name.c +++ b/crypto/x509/x_name.c @@ -472,19 +472,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)