]> git.sur5r.net Git - openldap/commitdiff
Fix prev commit
authorHoward Chu <hyc@openldap.org>
Sat, 30 Dec 2006 12:47:17 +0000 (12:47 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 30 Dec 2006 12:47:17 +0000 (12:47 +0000)
servers/slapd/attr.c

index 3c397c64f294cd21e664060ff7ab9714231607b1..a3b97370966239ab013806bdfcec6d884e9d7689 100644 (file)
@@ -187,15 +187,17 @@ attrs_free( Attribute *a )
 {
        Attribute *b;
 
-       for(b = a ; b != NULL ; b = b->a_next ) {
-               attr_clean( b );
-               if ( !b->a_next )
-                       break;
+       if ( a ) {
+               for(b = a ; ; b = b->a_next ) {
+                       attr_clean( b );
+                       if ( !b->a_next )
+                               break;
+               }
+               ldap_pvt_thread_mutex_lock( &attr_mutex );
+               b->a_next = attr_list;
+               attr_list = a;
+               ldap_pvt_thread_mutex_unlock( &attr_mutex );
        }
-       ldap_pvt_thread_mutex_lock( &attr_mutex );
-       b->a_next = attr_list;
-       attr_list = a;
-       ldap_pvt_thread_mutex_unlock( &attr_mutex );
 }
 
 static void