]> git.sur5r.net Git - openldap/commitdiff
fix use of dangling pointers (ITS#5924)
authorPierangelo Masarati <ando@openldap.org>
Thu, 5 Feb 2009 19:54:51 +0000 (19:54 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 5 Feb 2009 19:54:51 +0000 (19:54 +0000)
servers/slapd/bconfig.c

index 1a64b230aba101f8f2e8fbf75f66f552d90a1c9e..f651d9c1393f4ef7e3e6512e13fddde03a808c08 100644 (file)
@@ -3809,14 +3809,15 @@ config_rename_kids( CfEntryInfo *ce )
        struct berval rdn, nrdn;
 
        for (ce2 = ce->ce_kids; ce2; ce2 = ce2->ce_sibs) {
+               struct berval newdn, newndn;
                dnRdn ( &ce2->ce_entry->e_name, &rdn );
                dnRdn ( &ce2->ce_entry->e_nname, &nrdn );
+               build_new_dn( &newdn, &ce->ce_entry->e_name, &rdn, NULL );
+               build_new_dn( &newndn, &ce->ce_entry->e_nname, &nrdn, NULL );
                free( ce2->ce_entry->e_name.bv_val );
                free( ce2->ce_entry->e_nname.bv_val );
-               build_new_dn( &ce2->ce_entry->e_name, &ce->ce_entry->e_name,
-                       &rdn, NULL );
-               build_new_dn( &ce2->ce_entry->e_nname, &ce->ce_entry->e_nname,
-                       &nrdn, NULL );
+               ce2->ce_entry->e_name = newdn;
+               ce2->ce_entry->e_nname = newndn;
                config_rename_kids( ce2 );
        }
 }