[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Mon Oct 23 15:46:17 UTC 2017


The branch master has been updated
       via  04761b557a53f026630dd5916b2b8522d94579db (commit)
       via  590bbdfdf43b97abf8817f506f8ab46687d1eadd (commit)
      from  c9fe362303fc54ff19bde7511475f28663f7d554 (commit)


- Log -----------------------------------------------------------------
commit 04761b557a53f026630dd5916b2b8522d94579db
Author: Xiangyu Bu <xybu at users.noreply.github.com>
Date:   Tue Oct 17 17:10:53 2017 -0700

    Fix memory leak in GENERAL_NAME_set0_othername.
    
    CLA: trivial
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4544)

commit 590bbdfdf43b97abf8817f506f8ab46687d1eadd
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Oct 23 16:41:06 2017 +0200

    asn1_item_embed_new(): don't free an embedded item
    
    An embedded item wasn't allocated separately on the heap, so don't
    free it as if it was.
    
    Issue discovered by Pavel Kopyl
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4572)

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

Summary of changes:
 crypto/asn1/tasn_new.c  | 6 ++++--
 crypto/x509v3/v3_genn.c | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/crypto/asn1/tasn_new.c b/crypto/asn1/tasn_new.c
index f695e38..7608b43 100644
--- a/crypto/asn1/tasn_new.c
+++ b/crypto/asn1/tasn_new.c
@@ -142,7 +142,8 @@ int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
     return 1;
 
  memerr2:
-    ASN1_item_ex_free(pval, it);
+    if (!embed)
+        ASN1_item_ex_free(pval, it);
  memerr:
     ASN1err(ASN1_F_ASN1_ITEM_EMBED_NEW, ERR_R_MALLOC_FAILURE);
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
@@ -151,7 +152,8 @@ int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
     return 0;
 
  auxerr2:
-    ASN1_item_ex_free(pval, it);
+    if (!embed)
+        ASN1_item_ex_free(pval, it);
  auxerr:
     ASN1err(ASN1_F_ASN1_ITEM_EMBED_NEW, ASN1_R_AUX_ERROR);
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
diff --git a/crypto/x509v3/v3_genn.c b/crypto/x509v3/v3_genn.c
index 8d11997..85fc3fc 100644
--- a/crypto/x509v3/v3_genn.c
+++ b/crypto/x509v3/v3_genn.c
@@ -181,6 +181,7 @@ int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
     oth = OTHERNAME_new();
     if (oth == NULL)
         return 0;
+    ASN1_TYPE_free(oth->value);
     oth->type_id = oid;
     oth->value = value;
     GENERAL_NAME_set0_value(gen, GEN_OTHERNAME, oth);


More information about the openssl-commits mailing list