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>

Han-Wen Nienhuys committed Jan 20, 2022 at 15:12 UTC 049cdbb059c28051fb96e1aba56558acf4b597a2
1 file changed +5 -3
reftable/record.c
+5 -3
@@ -1154,9 +1154,11 @@ int reftable_ref_record_equal(struct reftable_ref_record *a,
1154 struct reftable_ref_record *b, int hash_size)
1155 {
1156 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)
1162 return 0;
1163
1164 switch (a->value_type) {