From 7445f4f8674ea0a02e4baff42342b0d9f7754114 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Mon, 21 Apr 2014 10:01:39 +0200 Subject: [PATCH] Fix bug #3150, "etpan_certificate_check() leaks memory" --- src/etpan/imap-thread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c index b71e4d746..ad5e3b3ef 100644 --- a/src/etpan/imap-thread.c +++ b/src/etpan/imap-thread.c @@ -536,13 +536,16 @@ static int etpan_certificate_check(const unsigned char *certificate, int len, vo tmp.size = len; gnutls_x509_crt_init(&cert); if (gnutls_x509_crt_import(cert, &tmp, GNUTLS_X509_FMT_DER) < 0) { + free(tmp.data); g_warning("IMAP: can't get cert\n"); return 0; } else if (ssl_certificate_check(cert, (guint)-1, (gchar *)param->server, (gushort)param->port) == TRUE) { + free(tmp.data); gnutls_x509_crt_deinit(cert); return 0; } else { + free(tmp.data); gnutls_x509_crt_deinit(cert); return -1; } -- 2.25.1