andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 7c1c79afd0147a03c7841fe6704421f4f52fee74 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@totoro.usersys.redhat.com>
dc8c34
Date: Tue, 5 Feb 2013 13:53:11 -0800
dc8c34
Subject: [PATCH 29/33] Bug 906005 - Valgrind reports memleak in
dc8c34
 modify_update_last_modified_attr
dc8c34
dc8c34
Fix description: plugin_get_dn returns plugin_dn, which is supposed
dc8c34
to be freed by the caller.  This patch adds the free function to
dc8c34
modify_update_last_modified_attr, add_created_attrs and
dc8c34
add_internal_modifiersname.
dc8c34
---
dc8c34
 ldap/servers/slapd/add.c      |    2 ++
dc8c34
 ldap/servers/slapd/opshared.c |    1 +
dc8c34
 2 files changed, 3 insertions(+), 0 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
dc8c34
index 3206d5b..44a9aa2 100644
dc8c34
--- a/ldap/servers/slapd/add.c
dc8c34
+++ b/ldap/servers/slapd/add.c
dc8c34
@@ -789,6 +789,7 @@ add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e)
dc8c34
 		}
dc8c34
 		slapi_entry_attr_replace(e, "internalCreatorsName", bvals);
dc8c34
 		slapi_entry_attr_replace(e, "internalModifiersName", bvals);
dc8c34
+		slapi_ch_free_string(&plugin_dn);
dc8c34
 
dc8c34
 		/* Grab the thread data(binddn) */
dc8c34
 		slapi_td_get_dn(&binddn);
dc8c34
@@ -1014,6 +1015,7 @@ add_internal_modifiersname(Slapi_PBlock *pb, Slapi_Entry *e)
dc8c34
             plugin_dn = plugin_get_dn (plugin);
dc8c34
         if(plugin_dn){
dc8c34
             slapi_entry_attr_set_charptr(e, "internalModifiersname", plugin_dn);
dc8c34
+            slapi_ch_free_string(&plugin_dn);
dc8c34
         }
dc8c34
     }
dc8c34
 }
dc8c34
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
dc8c34
index 485763e..fabe8a4 100644
dc8c34
--- a/ldap/servers/slapd/opshared.c
dc8c34
+++ b/ldap/servers/slapd/opshared.c
dc8c34
@@ -178,6 +178,7 @@ modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods)
dc8c34
         }
dc8c34
         slapi_mods_add_modbvps(smods, LDAP_MOD_REPLACE | LDAP_MOD_BVALUES,
dc8c34
                                   "internalModifiersName", bvals);
dc8c34
+        slapi_ch_free_string(&plugin_dn);
dc8c34
 
dc8c34
         /* Grab the thread data(binddn) */
dc8c34
         slapi_td_get_dn(&binddn);
dc8c34
-- 
dc8c34
1.7.7.6
dc8c34