From: Colin Leroy Date: Mon, 21 Apr 2014 08:01:39 +0000 (+0200) Subject: Fix bug #3150, "etpan_certificate_check() leaks memory" X-Git-Tag: 3.10.0~152 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=7445f4f8674ea0a02e4baff42342b0d9f7754114 Fix bug #3150, "etpan_certificate_check() leaks memory" --- 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; }