diff options
author | Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> | 2016-11-23 12:02:26 +0100 |
---|---|---|
committer | Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> | 2016-11-24 19:51:42 +0100 |
commit | 867e8fe25dbfb1e31493488ad695bde55b890397 (patch) | |
tree | 9575b1c404045cb63382ba3780d8377dbd2b2895 | |
parent | 66641221b54b976427d462617b239c971410aafa (diff) | |
download | exim4-exim-4_86_2+fixes.tar.gz |
Fix memory leak on (Gnu)TLS close.exim-4_86_2+fixes
This leak doesn't show up under normal operation, as the process
normally dies right after closing the session.
But during callout repetitive TLS sessions are opened and closed from
the same process (the process receiving the message). Depending on
the amount of RAM and the number of callouts the same process does,
this may be a problem. (On an amd64 machine with 4GB RAM, at about 1000
recipients the memory is exhausted.)
(cherry picked from commit ed62aae3051c9a713d35c8ae516fbd193d1401ba)
-rw-r--r-- | src/src/tls-gnu.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index 61ed0e81c..670f8cbc0 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -1729,6 +1729,7 @@ if (rc != GNUTLS_E_SUCCESS) if (!sigalrm_seen) { + gnutls_certificate_free_credentials(state->x509_cred); (void)fclose(smtp_out); (void)fclose(smtp_in); } @@ -2014,6 +2015,8 @@ if (shutdown) } gnutls_deinit(state->session); +gnutls_certificate_free_credentials(state->x509_cred); + state->tlsp->active = -1; memcpy(state, &exim_gnutls_state_init, sizeof(exim_gnutls_state_init)); @@ -2074,6 +2077,8 @@ if (state->xfer_buffer_lwm >= state->xfer_buffer_hwm) receive_smtp_buffered = smtp_buffered; gnutls_deinit(state->session); + gnutls_certificate_free_credentials(state->x509_cred); + state->session = NULL; state->tlsp->active = -1; state->tlsp->bits = 0; |