[PATCH] OCSP stapling: missing free calls.

Filipe DA SILVA fdasilva at ingima.com
Wed Apr 1 14:02:37 UTC 2015


Hello,

As I was working on this code, I see these missing calls.

Regards,
Filipe
www.ingima.com

---
# HG changeset patch
# User filipe da Silva <fdasilva at ingima.com>
# Date 1427893508 -7200
#      Wed Apr 01 15:05:08 2015 +0200
# Node ID aef78b6a0e789521c029694bf3f5f4fccfd43c69
# Parent  173561dfd5675903996975d57deb7a6f912048dc
OCSP stapling: missing free calls.

Missing call to X509_STORE_CTX_free when X509_STORE_CTX_init call fails.
Missing call to OCSP_CERTID_free when OCSP_request_add0_id call fails.
Possible leak in very particular scenarios of memory shortage.

diff -r 173561dfd567 -r aef78b6a0e78 src/event/ngx_event_openssl_stapling.c
--- a/src/event/ngx_event_openssl_stapling.c	Tue Mar 31 17:45:50 2015 +0300
+++ b/src/event/ngx_event_openssl_stapling.c	Wed Apr 01 15:05:08 2015 +0200
@@ -310,6 +310,7 @@ ngx_ssl_stapling_issuer(ngx_conf_t *cf, 
     if (X509_STORE_CTX_init(store_ctx, store, NULL, NULL) == 0) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                       "X509_STORE_CTX_init() failed");
+        X509_STORE_CTX_free(store_ctx);
         return NGX_ERROR;
     }
 
@@ -1118,6 +1119,7 @@ ngx_ssl_ocsp_create_request(ngx_ssl_ocsp
     if (OCSP_request_add0_id(ocsp, id) == NULL) {
         ngx_ssl_error(NGX_LOG_CRIT, ctx->log, 0,
                       "OCSP_request_add0_id() failed");
+		OCSP_CERTID_free(id);
         goto failed;
     }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6063.patch
Type: application/octet-stream
Size: 1282 bytes
Desc: 6063.patch
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20150401/72822b1f/attachment.obj>


More information about the nginx-devel mailing list