ldap/servers/plugins/acl/acl.c | 6 +++---
ldap/servers/plugins/acl/acl_ext.c | 3 +--
ldap/servers/plugins/acl/acllist.c | 5 +++--
3 files changed, 7 insertions(+), 7 deletions(-)
New commits:
commit 85bc265fd86e33ef97a82efe918730b76c2e4a62
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Oct 15 16:42:25 2013 -0400
Ticket 47519 - memory leaks in access control
The leaks originally reported in the ticket could not be reproduced by
myself or the reporter. This fix is completely theoretical, and solely
based on the valgrind report.
https://fedorahosted.org/389/ticket/47519
Reviewed by: richm(Thanks!)
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index ce0fb92..90ea0c1 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -3710,8 +3710,7 @@ acl_copyEval_context ( struct acl_pblock *aclpb, aclEvalContext
*src,
if ( aclpb) aclpb->aclpb_stat_num_copy_attrs++;
- if ( dest->acle_attrEval[dd_slot].attrEval_name )
- slapi_ch_free ( (void **) &dest->acle_attrEval[dd_slot].attrEval_name );
+ slapi_ch_free_string( &dest->acle_attrEval[dd_slot].attrEval_name);
dest->acle_attrEval[dd_slot].attrEval_name =
slapi_ch_strdup ( src->acle_attrEval[i].attrEval_name );
@@ -3730,7 +3729,7 @@ acl_copyEval_context ( struct acl_pblock *aclpb, aclEvalContext
*src,
}
dest->acle_numof_attrs = d_slot;
- dest->acle_attrEval[d_slot].attrEval_name = NULL;
+ slapi_ch_free_string( &dest->acle_attrEval[d_slot].attrEval_name);
if ( copy_attr_only )
return;
@@ -3927,6 +3926,7 @@ acl__get_attrEval ( struct acl_pblock *aclpb, char *attr )
c_attrEval->attrEval_s_aciIndex = 0;
}
/* clean it before use */
+ slapi_ch_free_string(&c_attrEval->attrEval_name);
c_attrEval->attrEval_name = slapi_ch_strdup ( attr );
aclpb->aclpb_curr_attrEval = c_attrEval;
}
diff --git a/ldap/servers/plugins/acl/acl_ext.c b/ldap/servers/plugins/acl/acl_ext.c
index c1b6b4a..b4327f6 100644
--- a/ldap/servers/plugins/acl/acl_ext.c
+++ b/ldap/servers/plugins/acl/acl_ext.c
@@ -991,8 +991,7 @@ acl__done_aclpb ( struct acl_pblock *aclpb )
slapi_sdn_done ( aclpb->aclpb_authorization_sdn );
aclpb->aclpb_pblock = NULL;
- if ( aclpb->aclpb_search_base )
- slapi_ch_free ( (void **) &aclpb->aclpb_search_base );
+ slapi_ch_free_string(&aclpb->aclpb_search_base );
for ( i=0; i < aclpb->aclpb_num_deny_handles; i++ )
aclpb->aclpb_deny_handles[i] = NULL;
aclpb->aclpb_num_deny_handles = 0;
diff --git a/ldap/servers/plugins/acl/acllist.c b/ldap/servers/plugins/acl/acllist.c
index c01bed3..cc0219d 100644
--- a/ldap/servers/plugins/acl/acllist.c
+++ b/ldap/servers/plugins/acl/acllist.c
@@ -639,6 +639,7 @@ acllist_init_scan (Slapi_PBlock *pb, int scope, const char *base)
basedn = slapi_ch_strdup (base);
index = 0;
+ slapi_ch_free_string(&aclpb->aclpb_search_base);
aclpb->aclpb_search_base = slapi_ch_strdup ( base );
while (basedn) {
@@ -651,7 +652,7 @@ acllist_init_scan (Slapi_PBlock *pb, int scope, const char *base)
(IFP) __acllist_aciContainer_node_cmp);
if ( index >= aclpb_max_selected_acls -2 ) {
aclpb->aclpb_handles_index[0] = -1;
- slapi_ch_free ( (void **) &basedn);
+ slapi_ch_free_string(&basedn);
break;
} else if ( NULL != root ) {
aclpb->aclpb_base_handles_index[index++] = root->acic_index;
@@ -664,7 +665,7 @@ acllist_init_scan (Slapi_PBlock *pb, int scope, const char *base)
"Failed to find root for base: %s \n", basedn );
}
tmp = slapi_dn_parent ( basedn );
- slapi_ch_free ( (void **) &basedn);
+ slapi_ch_free_string(&basedn);
basedn = tmp;
}