]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/repl.c
assert expects int. (int)<nonnull ptr/long> can be 0. Use assert(arg!=0/NULL).
[openldap] / servers / slapd / repl.c
index cfc2cb3d3bcf5c49b84328bf67d19ca9ff615699..89319152193e7898077e30b32b9bcb7c06e16286 100644 (file)
 
 int
 add_replica_info(
-    Backend     *be,
-    const char  *uri, 
-    const char  *host 
-)
+       Backend         *be,
+       const char      *uri, 
+       const char      *host )
 {
        int i = 0;
 
@@ -69,6 +68,45 @@ add_replica_info(
        return( i );
 }
 
+int
+destroy_replica_info(
+       Backend         *be )
+{
+       int i = 0;
+
+       assert( be != NULL );
+
+       if ( be->be_replica == NULL ) {
+               return 0;
+       }
+
+       for ( ; be->be_replica[ i ] != NULL; i++ ) {
+
+               ch_free( (char *)be->be_replica[ i ]->ri_uri );
+
+               ber_bvarray_free( be->be_replica[ i ]->ri_nsuffix );
+
+               if ( be->be_replica[ i ]->ri_attrs ) {
+                       AttributeName   *an = be->be_replica[ i ]->ri_attrs;
+                       int             j;
+
+                       for ( j = 0; !BER_BVISNULL( &an[ j ].an_name ); j++ )
+                       {
+                               ch_free( an[ j ].an_name.bv_val );
+                       }
+                       ch_free( an );
+               }
+
+               bindconf_free( &be->be_replica[ i ]->ri_bindconf );
+
+               ch_free( be->be_replica[ i ] );
+       }
+
+       ch_free( be->be_replica );
+
+       return 0;
+}
+
 int
 add_replica_suffix(
     Backend     *be,