The branch master has been updated
       via  01d0e241dc4184a5a1f222f8eccdad11da12305a (commit)
      from  e2bb9b9bf355792d89e131518cc0fd141d46ca5c (commit)


- Log -----------------------------------------------------------------
commit 01d0e241dc4184a5a1f222f8eccdad11da12305a
Author: Kurt Cancemi <[email protected]>
Date:   Thu May 26 16:38:31 2016 -0400

    crypto/x509/x509_vpm.c: Simplify int_x509_param_set1()
    
    This change also avoids calling strlen twice when srclen is 0
    
    Reviewed-by: Rich Salz <[email protected]>
    Reviewed-by: Matt Caswell <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 crypto/x509/x509_vpm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c
index f7ecdec..194d09b 100644
--- a/crypto/x509/x509_vpm.c
+++ b/crypto/x509/x509_vpm.c
@@ -259,12 +259,11 @@ static int int_x509_param_set1(char **pdest, size_t 
*pdestlen,
 {
     void *tmp;
     if (src) {
-        if (srclen == 0) {
-            tmp = OPENSSL_strdup(src);
+        if (srclen == 0)
             srclen = strlen(src);
-        } else
-            tmp = OPENSSL_memdup(src, srclen);
-        if (!tmp)
+
+        tmp = OPENSSL_memdup(src, srclen);
+        if (tmp == NULL)
             return 0;
     } else {
         tmp = NULL;
@@ -272,7 +271,7 @@ static int int_x509_param_set1(char **pdest, size_t 
*pdestlen,
     }
     OPENSSL_free(*pdest);
     *pdest = tmp;
-    if (pdestlen)
+    if (pdestlen != NULL)
         *pdestlen = srclen;
     return 1;
 }
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to