Skip to content

Commit 049cdbb

Browse files
hanwengitster
authored andcommitted
reftable: handle null refnames in reftable_ref_record_equal
Spotted by Coverity. Signed-off-by: Han-Wen Nienhuys <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6322511 commit 049cdbb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

reftable/record.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,9 +1154,11 @@ int reftable_ref_record_equal(struct reftable_ref_record *a,
11541154
struct reftable_ref_record *b, int hash_size)
11551155
{
11561156
assert(hash_size > 0);
1157-
if (!(0 == strcmp(a->refname, b->refname) &&
1158-
a->update_index == b->update_index &&
1159-
a->value_type == b->value_type))
1157+
if (!null_streq(a->refname, b->refname))
1158+
return 0;
1159+
1160+
if (a->update_index != b->update_index ||
1161+
a->value_type != b->value_type)
11601162
return 0;
11611163

11621164
switch (a->value_type) {

0 commit comments

Comments
 (0)