andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 2a2a33eb0bb08d81924f0e0a81168486b78f43ce Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Thu, 18 Jul 2013 15:50:36 -0400
Subject: [PATCH 85/99] Ticket 47421 - memory leaks in set_krb5_creds

Bug Description:  Valgrind shows memory leaks in set_krb5_creds()

Fix description:  krb5_unparse_name() allocates/returns the principle name.
                  But we can call this function twice without freeing the first
                  returned value.

https://fedorahosted.org/389/ticket/47421

Reviewed by: richm(Thanks!)
(cherry picked from commit db124a2711576de2dd0009528d60b2860e815210)
(cherry picked from commit c1dcfc605b56a61199d827f213c490e109d8279e)
---
 ldap/servers/slapd/ldaputil.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 3041f51..331dd71 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -1901,6 +1901,7 @@ set_krb5_creds(
         }
     }
 
+    slapi_ch_free_string(&princ_name);
     if ((rc = krb5_unparse_name(ctx, princ, &princ_name))) {
         slapi_log_error(SLAPI_LOG_FATAL, logname,
                         "Unable to get name of principal: "
-- 
1.8.1.4