From: Matt Caswell Date: Wed, 27 Apr 2016 12:40:52 +0000 (+0100) Subject: Don't leak resource on error in OCSP_url_svcloc_new X-Git-Tag: OpenSSL_1_1_0-pre6~1030 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a4e584a610e4a73f1fd7edef7e5b301c0be18bbf;p=oweals%2Fopenssl.git Don't leak resource on error in OCSP_url_svcloc_new On error we could leak a ACCESS_DESCRIPTION and an ASN1_IA5STRING. Both should be freed in the error path. Reviewed-by: Richard Levitte --- diff --git a/crypto/ocsp/ocsp_ext.c b/crypto/ocsp/ocsp_ext.c index 854da8e5c0..030ddf9dcc 100644 --- a/crypto/ocsp/ocsp_ext.c +++ b/crypto/ocsp/ocsp_ext.c @@ -509,12 +509,16 @@ X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, char **urls) goto err; ad->location->type = GEN_URI; ad->location->d.ia5 = ia5; + ia5 = NULL; if (!sk_ACCESS_DESCRIPTION_push(sloc->locator, ad)) goto err; + ad = NULL; urls++; } x = X509V3_EXT_i2d(NID_id_pkix_OCSP_serviceLocator, 0, sloc); err: + ASN1_IA5STRING_free(ia5); + ACCESS_DESCRIPTION_free(ad); OCSP_SERVICELOC_free(sloc); return x; }