dovecot-2.1: lib-ssl-iostream: Memory leak fixes
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jun 22 18:51:55 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/11c07ab07d39
changeset: 14570:11c07ab07d39
user: Timo Sirainen <tss at iki.fi>
date: Fri Jun 22 18:51:42 2012 +0300
description:
lib-ssl-iostream: Memory leak fixes
diffstat:
src/lib-ssl-iostream/iostream-openssl.c | 12 +++++++-----
src/lib-ssl-iostream/istream-openssl.c | 1 +
src/lib-ssl-iostream/ostream-openssl.c | 3 ++-
3 files changed, 10 insertions(+), 6 deletions(-)
diffs (64 lines):
diff -r e62979a15657 -r 11c07ab07d39 src/lib-ssl-iostream/iostream-openssl.c
--- a/src/lib-ssl-iostream/iostream-openssl.c Thu Jun 21 21:25:04 2012 +0300
+++ b/src/lib-ssl-iostream/iostream-openssl.c Fri Jun 22 18:51:42 2012 +0300
@@ -246,7 +246,7 @@
*_ssl_io = NULL;
i_assert(ssl_io->refcount > 0);
- if (--ssl_io->refcount >= 0)
+ if (--ssl_io->refcount > 0)
return;
ssl_iostream_free(ssl_io);
@@ -503,6 +503,7 @@
const char *dnsname;
bool dns_names = FALSE;
unsigned int i, count;
+ int ret;
cert = SSL_get_peer_certificate(ssl);
i_assert(cert != NULL);
@@ -520,14 +521,15 @@
}
}
sk_GENERAL_NAME_pop_free(gnames, GENERAL_NAME_free);
- X509_free(cert);
/* verify against CommonName only when there wasn't any DNS
SubjectAltNames */
if (dns_names)
- return i < count ? 0 : -1;
-
- return strcmp(get_cname(cert), verify_name) == 0 ? 0 : -1;
+ ret = i < count ? 0 : -1;
+ else
+ ret = strcmp(get_cname(cert), verify_name) == 0 ? 0 : -1;
+ X509_free(cert);
+ return ret;
}
int ssl_iostream_cert_match_name(struct ssl_iostream *ssl_io,
diff -r e62979a15657 -r 11c07ab07d39 src/lib-ssl-iostream/istream-openssl.c
--- a/src/lib-ssl-iostream/istream-openssl.c Thu Jun 21 21:25:04 2012 +0300
+++ b/src/lib-ssl-iostream/istream-openssl.c Fri Jun 22 18:51:42 2012 +0300
@@ -21,6 +21,7 @@
{
struct ssl_istream *sstream = (struct ssl_istream *)stream;
+ i_free(sstream->istream.w_buffer);
ssl_iostream_unref(&sstream->ssl_io);
}
diff -r e62979a15657 -r 11c07ab07d39 src/lib-ssl-iostream/ostream-openssl.c
--- a/src/lib-ssl-iostream/ostream-openssl.c Thu Jun 21 21:25:04 2012 +0300
+++ b/src/lib-ssl-iostream/ostream-openssl.c Fri Jun 22 18:51:42 2012 +0300
@@ -24,7 +24,8 @@
sstream->ssl_io->ssl_output = NULL;
ssl_iostream_unref(&sstream->ssl_io);
- i_free(sstream->buffer);
+ if (sstream->buffer != NULL)
+ buffer_free(&sstream->buffer);
}
static size_t
More information about the dovecot-cvs
mailing list