From c34481d21c51241e571873627a8da17556e153d2 Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Tue, 22 Jan 2019 08:10:30 +0100
Subject: [PATCH 67/99] Fix minor memory leak in auditd kerberos credentials
 code

---
 src/auditd-listen.c | 11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/auditd-listen.c b/src/auditd-listen.c
index 613cae6..bce8ca0 100644
--- a/src/auditd-listen.c
+++ b/src/auditd-listen.c
@@ -1107,7 +1107,11 @@ next_try:
 			}
 		}
 
-		server_acquire_creds(princ, &server_creds);
+		if (server_acquire_creds(princ, &server_creds)) {
+			free(my_service_name);
+			my_service_name = NULL;
+			return -1;
+		}
 	}
 #endif
 
@@ -1127,8 +1131,11 @@ void auditd_tcp_listen_uninit(struct ev_loop *loop, struct daemon_conf *config)
 	}
 
 #ifdef USE_GSSAPI
-	if (USE_GSS)
+	if (USE_GSS) {
 		gss_release_cred(&status, &server_creds);
+		free(my_service_name);
+		my_service_name = NULL;
+	}
 #endif
 
 	while (client_chain) {
-- 
1.8.3.1

