aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-03-21 14:55:12 -0700
committerJunio C Hamano <gitster@pobox.com>2024-03-21 14:55:12 -0700
commit3eba921f813641cdac96532c5c4fd99358a8cbb8 (patch)
treecc2bd145b34de1cd745d2111086e7386af911a5e
parent330ed38a2df0d67e247edc7ea69175520ead469d (diff)
parentfffd981ec2d7965733a4a15f9071e3734f7654a6 (diff)
downloadgit-3eba921f813641cdac96532c5c4fd99358a8cbb8.tar.gz
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
-rw-r--r--reftable/block.c2
-rw-r--r--reftable/record.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/reftable/block.c b/reftable/block.c
index ad9074dba6..c469a9b529 100644
--- a/reftable/block.c
+++ b/reftable/block.c
@@ -301,7 +301,7 @@ static int restart_key_less(size_t idx, void *args)
result = strbuf_cmp(&a->key, &rkey);
strbuf_release(&rkey);
- return result;
+ return result < 0;
}
void block_iter_copy_from(struct block_iter *dest, struct block_iter *src)
diff --git a/reftable/record.c b/reftable/record.c
index 367de04600..2e2061d082 100644
--- a/reftable/record.c
+++ b/reftable/record.c
@@ -588,6 +588,8 @@ static int reftable_obj_record_decode(void *rec, struct strbuf key,
uint64_t last;
int j;
+ reftable_obj_record_release(r);
+
REFTABLE_ALLOC_ARRAY(r->hash_prefix, key.len);
memcpy(r->hash_prefix, key.buf, key.len);
r->hash_prefix_len = key.len;