r3095: - fix a free'ing of msg.dn
authorStefan Metzmacher <metze@samba.org>
Wed, 20 Oct 2004 20:48:31 +0000 (20:48 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:02:20 +0000 (13:02 -0500)
- reenable index tests

metze

source/lib/ldb/ldb_tdb/ldb_search.c
source/lib/ldb/ldb_tdb/ldb_tdb.c
source/lib/ldb/tests/test-generic.sh

index a11f137cc998e12ebea68fbae3ed03db5aa3297e..18d51d1aa4b55dba6d26775d894d43877b5bb1c5 100644 (file)
@@ -266,7 +266,6 @@ int ltdb_has_wildcard(struct ldb_context *ldb, const char *attr_name,
 void ltdb_search_dn1_free(struct ldb_context *ldb, struct ldb_message *msg)
 {
        unsigned int i;
-       ldb_free(ldb, msg->dn);
        ldb_free(ldb, msg->private_data);
        for (i=0;i<msg->num_elements;i++) {
                ldb_free(ldb, msg->elements[i].values);
index 934ec68958aedb9b974995d2cc3dd83cb7c3692e..3d136ea014a0a5cc8d125f2afdcd7bf245c2a49f 100644 (file)
@@ -608,7 +608,6 @@ static int ltdb_rename(struct ldb_context *ldb, const char *olddn, const char *n
                goto failed;
        }
 
-       ldb_free(ldb, msg.dn);
        msg.dn = ldb_strdup(ldb,newdn);
        if (!msg.dn) {
                ltdb_search_dn1_free(ldb, &msg);
@@ -617,9 +616,11 @@ static int ltdb_rename(struct ldb_context *ldb, const char *olddn, const char *n
 
        ret = ltdb_add(ldb, &msg);
        if (ret == -1) {
+               ldb_free(ldb, msg.dn);
                ltdb_search_dn1_free(ldb, &msg);
                goto failed;
        }
+       ldb_free(ldb, msg.dn);
        ltdb_search_dn1_free(ldb, &msg);
 
        ret = ltdb_delete(ldb, olddn);
index a012158de104b22cab245c5442dbf8e8930d41ac..b70b81773235a94453adb2725a0da18b68930c34 100755 (executable)
@@ -17,14 +17,14 @@ $VALGRIND bin/ldbrename "$OLDDN" "$NEWDN"  || exit 1
 echo "Showing renamed record"
 $VALGRIND bin/ldbsearch '(uid=uham)' || exit 1
 
-#echo "Starting ldbtest"
-#time $VALGRIND bin/ldbtest -r 1000 -s 10  || exit 1
+echo "Starting ldbtest"
+time $VALGRIND bin/ldbtest -r 1000 -s 10  || exit 1
 
-#echo "Adding index"
-#$VALGRIND bin/ldbadd tests/test-index.ldif  || exit 1
+echo "Adding index"
+$VALGRIND bin/ldbadd tests/test-index.ldif  || exit 1
 
-#echo "Starting ldbtest indexed"
-#time $VALGRIND bin/ldbtest -r 1000 -s 5000  || exit 1
+echo "Starting ldbtest indexed"
+time $VALGRIND bin/ldbtest -r 1000 -s 5000  || exit 1
 
 echo "Testing one level search"
 count=`$VALGRIND bin/ldbsearch -b 'ou=Groups,o=University of Michigan,c=US' -s one 'objectclass=*' none |grep ^dn | wc -l`