r13773: Be consistent in the way you get out and free allocated data
authorSimo Sorce <idra@samba.org>
Wed, 1 Mar 2006 20:06:34 +0000 (20:06 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:52:11 +0000 (13:52 -0500)
(This used to be commit 1113d4caa7bea1a7ffb9a50f42c5672bc1d452b4)

source4/lib/tdb/common/traverse.c

index 00fe5be923b0db8eb2534507e9a02e043badaf15..dc1060c6d0d34c1fba1bf59e8db0ddf2b56ef229 100644 (file)
@@ -173,6 +173,7 @@ static int tdb_traverse_internal(struct tdb_context *tdb,
                /* Drop chain lock, call out */
                if (tdb_unlock(tdb, tl->hash, tl->lock_rw) != 0) {
                        ret = -1;
+                       SAFE_FREE(key.dptr);
                        goto out;
                }
                if (fn && fn(tdb, key, dbuf, private)) {
@@ -182,9 +183,8 @@ static int tdb_traverse_internal(struct tdb_context *tdb,
                                TDB_LOG((tdb, 0, "tdb_traverse: unlock_record failed!\n"));;
                                ret = -1;
                        }
-                       tdb->travlocks.next = tl->next;
                        SAFE_FREE(key.dptr);
-                       return count;
+                       goto out;
                }
                SAFE_FREE(key.dptr);
        }