From: Andy Polyakov Date: Sat, 14 Oct 2017 08:21:19 +0000 (+0200) Subject: x509v3/v3_utl.c: avoid double-free. X-Git-Tag: OpenSSL_1_1_1-pre1~537 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=432f8688bb72e21939845ac7a69359ca718c6676;p=oweals%2Fopenssl.git x509v3/v3_utl.c: avoid double-free. Thanks to David Benjamin for spotting this. Reviewed-by: Rich Salz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/4532) --- diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c index a839861dba..4dbcfaa430 100644 --- a/crypto/x509v3/v3_utl.c +++ b/crypto/x509v3/v3_utl.c @@ -56,8 +56,10 @@ int X509V3_add_value(const char *name, const char *value, return 1; err: X509V3err(X509V3_F_X509V3_ADD_VALUE, ERR_R_MALLOC_FAILURE); - if (sk_allocated) + if (sk_allocated) { sk_CONF_VALUE_free(*extlist); + *extlist = NULL; + } OPENSSL_free(vtmp); OPENSSL_free(tname); OPENSSL_free(tvalue);