]> granicus.if.org Git - apache/commitdiff
add cleanup of SSLStateMachine to tls filter
authorDoug MacEachern <dougm@apache.org>
Wed, 18 Jul 2001 18:18:20 +0000 (18:18 +0000)
committerDoug MacEachern <dougm@apache.org>
Wed, 18 Jul 2001 18:18:20 +0000 (18:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89597 13f79535-47bb-0310-9956-ffa450edef68

modules/tls/mod_tls.c
modules/tls/openssl_state_machine.c
modules/tls/openssl_state_machine.h

index b5cf15b23db3a248f185b90a7d34a4fbb87e57bb..df9fd59515bda38ddfc61b5ae43206da0efc569b 100644 (file)
@@ -117,6 +117,12 @@ static const char *tls_cert_file(cmd_parms *cmd, void *dummy, const char *arg)
     return NULL;
 }
 
+static apr_status_t tls_filter_cleanup(void *data)
+{
+    SSLStateMachine_destroy((SSLStateMachine *)data);
+    return APR_SUCCESS;
+}
+
 static int tls_filter_inserter(conn_rec *c)
 {
     TLSServerConfig *pConfig =
@@ -136,6 +142,9 @@ static int tls_filter_inserter(conn_rec *c)
     pCtx->pbbInput=apr_brigade_create(c->pool);
     pCtx->pbbPendingInput=apr_brigade_create(c->pool);
 
+    apr_pool_cleanup_register(c->pool, (void*)pCtx->pStateMachine,
+                              tls_filter_cleanup, apr_pool_cleanup_null);
+
     return OK;
 }
 
index 171a1aa23dae51e3b052132a0d95d56744ce2d80..4f626e9efbf2a550f47f46fae1eb67b05f5c887a 100644 (file)
@@ -162,6 +162,12 @@ SSLStateMachine *SSLStateMachine_new(const char *szCertificateFile,
     return pMachine;
     }
 
+void SSLStateMachine_destroy(SSLStateMachine *pMachine)
+{
+    SSL_free(pMachine->pSSL);
+    free(pMachine);
+}
+
 void SSLStateMachine_read_inject(SSLStateMachine *pMachine,
                                 const unsigned char *aucBuf,int nBuf)
     {
index 10be69a3b073878085eeba1605f3d5e850daf516..581baf9c9b524779e24b95880bd992109289fec7 100644 (file)
@@ -3,6 +3,7 @@ typedef struct SSLStateMachine SSLStateMachine;
 void SSLStateMachine_init(void);
 SSLStateMachine *SSLStateMachine_new(const char *szCertificateFile,
                                     const char *szKeyFile);
+void SSLStateMachine_destroy(SSLStateMachine *pMachine);
 void SSLStateMachine_read_inject(SSLStateMachine *pMachine,
                                 const unsigned char *aucBuf,int nBuf);
 int SSLStateMachine_read_extract(SSLStateMachine *pMachine,