From 68a0e0d922e41302c14de2e8387526cdc9a01626 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 1 Jan 2007 13:42:36 +0000 Subject: [PATCH] Revert to ordering behavior of original attrs_free() --- servers/slapd/attr.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index a3b9737096..3880e43db4 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -185,17 +185,21 @@ comp_tree_free( Attribute *a ) void attrs_free( Attribute *a ) { - Attribute *b; + Attribute *b, *tail, *next; if ( a ) { - for(b = a ; ; b = b->a_next ) { - attr_clean( b ); - if ( !b->a_next ) - break; - } + tail = a; + do { + next = a->a_next; + attr_clean( a ); + a->a_next = b; + b = a; + a = next; + } while ( next ); + ldap_pvt_thread_mutex_lock( &attr_mutex ); - b->a_next = attr_list; - attr_list = a; + tail->a_next = attr_list; + attr_list = b; ldap_pvt_thread_mutex_unlock( &attr_mutex ); } } -- 2.39.5