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