]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/attr.c
Hide log schema
[openldap] / servers / slapd / attr.c
index 3880e43db4e2085d3005c1f275edf7f18d1cb429..315442466f4403587a8ba80ed6fb722294c40814 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -185,9 +185,10 @@ comp_tree_free( Attribute *a )
 void
 attrs_free( Attribute *a )
 {
-       Attribute *b, *tail, *next;
-
        if ( a ) {
+               Attribute *b = (Attribute *)0xBAD, *tail, *next;
+
+               /* save tail */
                tail = a;
                do {
                        next = a->a_next;
@@ -198,6 +199,8 @@ attrs_free( Attribute *a )
                } while ( next );
 
                ldap_pvt_thread_mutex_lock( &attr_mutex );
+               /* replace NULL with current attr list and let attr list
+                * start from last attribute returned to list */
                tail->a_next = attr_list;
                attr_list = b;
                ldap_pvt_thread_mutex_unlock( &attr_mutex );
@@ -377,7 +380,6 @@ attr_normalize(
                *nvalsp = nvals;
        }
 
-error_return:;
        if ( rc != LDAP_SUCCESS && nvals != NULL ) {
                ber_bvarray_free_x( nvals, memctx );
        }