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

[trafficserver] branch 7.1.x updated: Fix leak in stapling_refresh_response

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

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new e8f4edf  Fix leak in stapling_refresh_response
e8f4edf is described below

commit e8f4edf02260afe5a062e4f8530b982a79dbf8c0
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
    
    (cherry picked from commit fb47f06908f958a339ed8a257f06ce82bf5855c0)
    
    Conflicts:
    	iocore/net/OCSPStapling.cc
---
 iocore/net/OCSPStapling.cc | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/iocore/net/OCSPStapling.cc b/iocore/net/OCSPStapling.cc
index 88236f3..ce06b94 100644
--- a/iocore/net/OCSPStapling.cc
+++ b/iocore/net/OCSPStapling.cc
@@ -340,7 +340,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;
 
@@ -380,18 +380,22 @@ 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)
     OCSP_REQUEST_free(req);
   if (*prsp)
     OCSP_RESPONSE_free(*prsp);
-  return rv;
 
-err:
-  rv = false;
-  Error("stapling_refresh_response: failed to refresh OCSP response");
-  goto done;
+  OPENSSL_free(host);
+  OPENSSL_free(path);
+  OPENSSL_free(port);
+  return rv;
 }
 
 void