]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
release memory if needed
authorGiovanni Bechis <gbechis@apache.org>
Thu, 24 Feb 2022 11:39:59 +0000 (11:39 +0000)
committerGiovanni Bechis <gbechis@apache.org>
Thu, 24 Feb 2022 11:39:59 +0000 (11:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898366 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_util_ocsp.c
modules/ssl/ssl_util_stapling.c

index b8d27f9be73036ee2379787c5497bfa4287fd6d6..fbbec07acc63e8f53d113ed9e9a5a46cc444627c 100644 (file)
@@ -373,8 +373,11 @@ static STACK_OF(X509) *modssl_read_ocsp_certificates(const char *file)
     while ((x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL)) != NULL) {
         if (!other_certs) {
                 other_certs = sk_X509_new_null();
-                if (!other_certs)
+                if (!other_certs) {
+                        X509_free(x509);
+                        BIO_free(bio);
                         return NULL;
+                }
         }
                 
         if (!sk_X509_push(other_certs, x509)) {
index 88ad0b74192b030fc6df88d9ee658981278a67b8..8ccbbe4034b109fca63163dcb236e5830d963cb2 100644 (file)
@@ -113,8 +113,10 @@ static X509 *stapling_get_issuer(modssl_ctx_t *mctx, X509 *x)
     }
 
     inctx = X509_STORE_CTX_new();
-    if (!X509_STORE_CTX_init(inctx, st, NULL, NULL))
+    if (!X509_STORE_CTX_init(inctx, st, NULL, NULL)) {
+        X509_STORE_CTX_free(inctx);
         return 0;
+    }
     if (X509_STORE_CTX_get1_issuer(&issuer, inctx, x) <= 0)
         issuer = NULL;
     X509_STORE_CTX_cleanup(inctx);