Missing free item on push failure
authorFdaSilvaYY <fdasilvayy@gmail.com>
Fri, 11 Nov 2016 09:58:34 +0000 (10:58 +0100)
committerRich Salz <rsalz@openssl.org>
Thu, 17 Nov 2016 01:54:53 +0000 (20:54 -0500)
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1905)

crypto/x509v3/v3_utl.c

index 05edd85cf47ea277426fde7dab41b1523246fdd8..7dc9a4533efa26a7decc4b3dd3539382fccdf2b2 100644 (file)
@@ -469,6 +469,7 @@ static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, const ASN1_IA5STRING *email
         return 1;
     emtmp = OPENSSL_strdup((char *)email->data);
     if (emtmp == NULL || !sk_OPENSSL_STRING_push(*sk, emtmp)) {
+        OPENSSL_free(emtmp);    /* free on push failure */
         X509_email_free(*sk);
         *sk = NULL;
         return 0;