Fix memory leak on bad inputs.
authorBodo Möller <bodo@openssl.org>
Mon, 5 Sep 2011 09:56:48 +0000 (09:56 +0000)
committerBodo Möller <bodo@openssl.org>
Mon, 5 Sep 2011 09:56:48 +0000 (09:56 +0000)
CHANGES
crypto/asn1/x_name.c

diff --git a/CHANGES b/CHANGES
index a3ee3b0bc619d9dd19ba8ca07974e43c3a6337fa..a885be40f6a91b7a09fc18bd30b9709702a7e53f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@
 
  Changes between 0.9.8r and 0.9.8s [xx XXX xxxx]
 
+  *) Fix x509_name_ex_d2i memory leak on bad inputs.
+     [Bodo Moeller]
+
   *) Add protection against ECDSA timing attacks as mentioned in the paper
      by Billy Bob Brumley and Nicola Tuveri, see:
 
index 04380abc3ff9b2d99a0449e7eaf6e9c69508a4aa..9a1a9f415ff3a73f98f4b6aedefb5c296a50457a 100644 (file)
@@ -196,7 +196,9 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len
        *val = nm.a;
        *in = p;
        return ret;
-       err:
+err:
+        if (nm.x != NULL)
+               X509_NAME_free(nm.x);
        ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
        return 0;
 }