Skip to content

Commit 3eba921

Browse files
committed
Merge branch 'ps/reftable-block-search-fix'
The reftable code has its own custom binary search function whose comparison callback has an unusual interface, which caused the binary search to degenerate into a linear search, which has been corrected. * ps/reftable-block-search-fix: reftable/block: fix binary search over restart counter reftable/record: fix memory leak when decoding object records
2 parents 330ed38 + fffd981 commit 3eba921

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

reftable/block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static int restart_key_less(size_t idx, void *args)
301301

302302
result = strbuf_cmp(&a->key, &rkey);
303303
strbuf_release(&rkey);
304-
return result;
304+
return result < 0;
305305
}
306306

307307
void block_iter_copy_from(struct block_iter *dest, struct block_iter *src)

reftable/record.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,8 @@ static int reftable_obj_record_decode(void *rec, struct strbuf key,
588588
uint64_t last;
589589
int j;
590590

591+
reftable_obj_record_release(r);
592+
591593
REFTABLE_ALLOC_ARRAY(r->hash_prefix, key.len);
592594
memcpy(r->hash_prefix, key.buf, key.len);
593595
r->hash_prefix_len = key.len;

0 commit comments

Comments
 (0)