You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by rr...@apache.org on 2018/10/24 14:16:17 UTC

[trafficserver] branch master updated: Fix leak in stapling_refresh_response

This is an automated email from the ASF dual-hosted git repository.

rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a2fc8c  Fix leak in stapling_refresh_response
1a2fc8c is described below

commit 1a2fc8ca252481b526d91b3c963c02148614892a
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Mon Oct 22 08:06:44 2018 -0700

    Fix leak in stapling_refresh_response
    
    Prior to fix, memory is leaked for every cert every OCSP refresh
---
 iocore/net/OCSPStapling.cc | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/iocore/net/OCSPStapling.cc b/iocore/net/OCSPStapling.cc
index a6497b0..1fe2520 100644
--- a/iocore/net/OCSPStapling.cc
+++ b/iocore/net/OCSPStapling.cc
@@ -349,7 +349,7 @@ stapling_refresh_response(certinfo *cinf, OCSP_RESPONSE **prsp)
   bool rv           = true;
   OCSP_REQUEST *req = nullptr;
   OCSP_CERTID *id   = nullptr;
-  char *host, *path, *port;
+  char *host = nullptr, *port = nullptr, *path = nullptr;
   int ssl_flag    = 0;
   int req_timeout = -1;
 
@@ -392,6 +392,11 @@ stapling_refresh_response(certinfo *cinf, OCSP_RESPONSE **prsp)
   } else {
     Debug("ssl_ocsp", "stapling_refresh_response: successful refresh OCSP response");
   }
+  goto done;
+
+err:
+  rv = false;
+  Error("stapling_refresh_response: failed to refresh OCSP response");
 
 done:
   if (req) {
@@ -400,12 +405,10 @@ done:
   if (*prsp) {
     OCSP_RESPONSE_free(*prsp);
   }
+  OPENSSL_free(host);
+  OPENSSL_free(path);
+  OPENSSL_free(port);
   return rv;
-
-err:
-  rv = false;
-  Error("stapling_refresh_response: failed to refresh OCSP response");
-  goto done;
 }
 
 void