Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2022-01-20 18:12:09 +0300
committerJunio C Hamano <gitster@pobox.com>2022-01-20 22:31:53 +0300
commit049cdbb059c28051fb96e1aba56558acf4b597a2 (patch)
tree501ad791ba3d09cfd834c5b12c1691a319fa9b5a /reftable
parent6322511148447d30c8c43b63f4561a86d177b620 (diff)
reftable: handle null refnames in reftable_ref_record_equal
Spotted by Coverity. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable')
-rw-r--r--reftable/record.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/reftable/record.c b/reftable/record.c
index 8536bd03aa..8bbcbff1e6 100644
--- a/reftable/record.c
+++ b/reftable/record.c
@@ -1154,9 +1154,11 @@ int reftable_ref_record_equal(struct reftable_ref_record *a,
struct reftable_ref_record *b, int hash_size)
{
assert(hash_size > 0);
- if (!(0 == strcmp(a->refname, b->refname) &&
- a->update_index == b->update_index &&
- a->value_type == b->value_type))
+ if (!null_streq(a->refname, b->refname))
+ return 0;
+
+ if (a->update_index != b->update_index ||
+ a->value_type != b->value_type)
return 0;
switch (a->value_type) {