]> git.sur5r.net Git - openldap/commitdiff
more about freeing replica resources
authorPierangelo Masarati <ando@openldap.org>
Sun, 7 Aug 2005 15:20:14 +0000 (15:20 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 7 Aug 2005 15:20:14 +0000 (15:20 +0000)
servers/slapd/backend.c
servers/slapd/bconfig.c

index b5204ce7bc347b898670fcda8895eb103bd8bbe2..e100b600222133a7018f6f7a8009fbef497a9e9c 100644 (file)
@@ -426,6 +426,12 @@ void backend_destroy_one( BackendDB *bd, int dynamic )
                ch_free( bd->be_replogfile );
        }
        destroy_replica_info( bd );
+       if ( !BER_BVISNULL( &bd->be_update_ndn ) ) {
+               ch_free( bd->be_update_ndn.bv_val );
+       }
+       if ( bd->be_update_refs ) {
+               ber_bvarray_free( bd->be_update_refs );
+       }
 
        if ( dynamic ) {
                free( bd );
index 472f7b4ccf0d501b12ed5f098f04c793109e07a8..77d9065f01a8caa0240de2b29961af818a226f3d 100644 (file)
@@ -2292,7 +2292,7 @@ config_updatedn(ConfigArgs *c) {
                return 1;
        } else if ( c->op == LDAP_MOD_DELETE ) {
                ch_free( c->be->be_update_ndn.bv_val );
-               c->be->be_update_ndn.bv_val = NULL;
+               BER_BVZERO( &c->be->be_update_ndn );
                SLAP_DBFLAGS(c->be) ^= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW);
                return 0;
        }
@@ -2303,17 +2303,13 @@ config_updatedn(ConfigArgs *c) {
                return(1);
        }
 
-       ber_str2bv(c->argv[1], 0, 0, &dn);
-
-       rc = dnNormalize(0, NULL, NULL, &dn, &c->be->be_update_ndn, NULL);
-
-       if(rc != LDAP_SUCCESS) {
-               sprintf( c->msg, "<%s> invalid DN %d (%s)", c->argv[0],
-                       rc, ldap_err2string(rc));
-               Debug(LDAP_DEBUG_ANY, "%s: %s\n",
-                       c->log, c->msg, 0 );
-               return(1);
+       ber_memfree_x( c->value_dn.bv_val, NULL );
+       if ( !BER_BVISNULL( &c->be->be_update_ndn ) ) {
+               ber_memfree_x( c->be->be_update_ndn.bv_val, NULL );
        }
+       c->be->be_update_ndn = c->value_ndn;
+       BER_BVZERO( &c->value_dn );
+       BER_BVZERO( &c->value_ndn );
 
        SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW);
        return(0);