andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 7c1c79afd0147a03c7841fe6704421f4f52fee74 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@totoro.usersys.redhat.com>
Date: Tue, 5 Feb 2013 13:53:11 -0800
Subject: [PATCH 29/33] Bug 906005 - Valgrind reports memleak in
 modify_update_last_modified_attr

Fix description: plugin_get_dn returns plugin_dn, which is supposed
to be freed by the caller.  This patch adds the free function to
modify_update_last_modified_attr, add_created_attrs and
add_internal_modifiersname.
---
 ldap/servers/slapd/add.c      |    2 ++
 ldap/servers/slapd/opshared.c |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index 3206d5b..44a9aa2 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -789,6 +789,7 @@ add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e)
 		}
 		slapi_entry_attr_replace(e, "internalCreatorsName", bvals);
 		slapi_entry_attr_replace(e, "internalModifiersName", bvals);
+		slapi_ch_free_string(&plugin_dn);
 
 		/* Grab the thread data(binddn) */
 		slapi_td_get_dn(&binddn);
@@ -1014,6 +1015,7 @@ add_internal_modifiersname(Slapi_PBlock *pb, Slapi_Entry *e)
             plugin_dn = plugin_get_dn (plugin);
         if(plugin_dn){
             slapi_entry_attr_set_charptr(e, "internalModifiersname", plugin_dn);
+            slapi_ch_free_string(&plugin_dn);
         }
     }
 }
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 485763e..fabe8a4 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -178,6 +178,7 @@ modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods)
         }
         slapi_mods_add_modbvps(smods, LDAP_MOD_REPLACE | LDAP_MOD_BVALUES,
                                   "internalModifiersName", bvals);
+        slapi_ch_free_string(&plugin_dn);
 
         /* Grab the thread data(binddn) */
         slapi_td_get_dn(&binddn);
-- 
1.7.7.6