Blame SOURCES/0018-journal-remote-fix-client_cert-memory-leak.patch

17b0f1
From 0488761858a3bfbf06a25fbf3bc0e28fdfc28234 Mon Sep 17 00:00:00 2001
17b0f1
From: Michal Schmidt <mschmidt@redhat.com>
17b0f1
Date: Tue, 17 Feb 2015 10:36:57 +0100
17b0f1
Subject: [PATCH] journal-remote: fix client_cert memory leak
17b0f1
17b0f1
Found by Valgrind while testing the previous memory leak fix.
17b0f1
17b0f1
(cherry picked from commit 32c3d7144cf9a5c8c03761d7f198142ca0f5f7b8)
17b0f1
---
17b0f1
 src/journal-remote/microhttpd-util.c | 6 +++++-
17b0f1
 1 file changed, 5 insertions(+), 1 deletion(-)
17b0f1
17b0f1
diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c
17b0f1
index de9c6ab32d..a95fff18f3 100644
17b0f1
--- a/src/journal-remote/microhttpd-util.c
17b0f1
+++ b/src/journal-remote/microhttpd-util.c
17b0f1
@@ -239,10 +239,14 @@ static int get_auth_dn(gnutls_x509_crt_t client_cert, char **buf) {
17b0f1
         return 0;
17b0f1
 }
17b0f1
 
17b0f1
+static inline void gnutls_x509_crt_deinitp(gnutls_x509_crt_t *p) {
17b0f1
+        gnutls_x509_crt_deinit(*p);
17b0f1
+}
17b0f1
+
17b0f1
 int check_permissions(struct MHD_Connection *connection, int *code, char **hostname) {
17b0f1
         const union MHD_ConnectionInfo *ci;
17b0f1
         gnutls_session_t session;
17b0f1
-        gnutls_x509_crt_t client_cert;
17b0f1
+        _cleanup_(gnutls_x509_crt_deinitp) gnutls_x509_crt_t client_cert = NULL;
17b0f1
         _cleanup_free_ char *buf = NULL;
17b0f1
         int r;
17b0f1