tdb2: fix bucket search
[ccan] / ccan / tdb2 / free.c
index 48cd9c315ce02f4859ea15b0ec6de97ccde132d5..f5107fadfbd888efae8094b1ff8d3cc4010c3ca8 100644 (file)
@@ -559,7 +559,7 @@ static tdb_off_t get_free(struct tdb_context *tdb,
                b = size_to_bucket(tdb->zhdr.zone_bits, size);
                for (b = find_free_head(tdb, b);
                     b <= BUCKETS_FOR_ZONE(tdb->zhdr.zone_bits);
-                    b += find_free_head(tdb, b + 1)) {
+                    b = find_free_head(tdb, b + 1)) {
                        /* Try getting one from list. */
                        off = lock_and_alloc(tdb, tdb->zone_off,
                                             tdb->zhdr.zone_bits,