X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fattr.c;h=ee0f46daabc5d87fc631f06bb2c5f13295a6d49c;hb=5c3a4e176e9539f58a1ac666ad370b4c204cd44c;hp=0513a9d2d5cbc312e2668b3f6aef76c4aa13c810;hpb=a90e63fde0f09d2a4649ef8adf485c7d3d15eb81;p=openldap diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 0513a9d2d5..ee0f46daab 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2004 The OpenLDAP Foundation. + * Copyright 1998-2005 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,23 +40,32 @@ #include "slap.h" -#ifdef LDAP_COMP_MATCH -extern free_component_func* component_destructor; -#endif void attr_free( Attribute *a ) { - if ( a->a_nvals && a->a_nvals != a->a_vals ) + if ( a->a_nvals && a->a_nvals != a->a_vals ) { ber_bvarray_free( a->a_nvals ); + } ber_bvarray_free( a->a_vals ); + free( a ); +} + #ifdef LDAP_COMP_MATCH - if ( component_destructor && a->a_component_values ) { - component_destructor(a->a_component_values); - a->a_component_values = NULL; +void +comp_tree_free( Attribute *a ) +{ + Attribute *next; + + for( ; a != NULL ; a = next ) { + next = a->a_next; + if ( component_destructor && a->a_comp_data ) { + if ( a->a_comp_data->cd_mem_op ) + component_destructor( a->a_comp_data->cd_mem_op ); + free ( a->a_comp_data ); + } } -#endif - free( a ); } +#endif void attrs_free( Attribute *a ) @@ -118,7 +127,7 @@ attr_dup( Attribute *a ) tmp->a_next = NULL; tmp->a_flags = 0; #ifdef LDAP_COMP_MATCH - tmp->a_component_values = NULL; + tmp->a_comp_data = NULL; #endif return tmp; @@ -168,7 +177,7 @@ attr_merge( Attribute **a; for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) { - if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) { + if ( (*a)->a_desc == desc ) { break; } } @@ -181,7 +190,7 @@ attr_merge( (*a)->a_next = NULL; (*a)->a_flags = 0; #ifdef LDAP_COMP_MATCH - (*a)->a_component_values = NULL; + (*a)->a_comp_data = NULL; #endif } @@ -252,7 +261,7 @@ attr_merge_one( Attribute **a; for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) { - if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) { + if ( (*a)->a_desc == desc ) { break; } } @@ -265,7 +274,7 @@ attr_merge_one( (*a)->a_next = NULL; (*a)->a_flags = 0; #ifdef LDAP_COMP_MATCH - (*a)->a_component_values = NULL; + (*a)->a_comp_data = NULL; #endif } @@ -344,7 +353,7 @@ attr_find( AttributeDescription *desc ) { for ( ; a != NULL; a = a->a_next ) { - if ( ad_cmp( a->a_desc, desc ) == 0 ) { + if ( a->a_desc == desc ) { return( a ); } } @@ -367,7 +376,7 @@ attr_delete( Attribute **a; for ( a = attrs; *a != NULL; a = &(*a)->a_next ) { - if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) { + if ( (*a)->a_desc == desc ) { Attribute *save = *a; *a = (*a)->a_next; attr_free( save );