]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reftable: handle null refnames in reftable_ref_record_equal
authorHan-Wen Nienhuys <hanwen@google.com>
Thu, 20 Jan 2022 15:12:09 +0000 (15:12 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Jan 2022 19:31:53 +0000 (11:31 -0800)
Spotted by Coverity.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/record.c

index 8536bd03aa9ea36033992b7430cc80678f3ffc03..8bbcbff1e693ca62bb40139b3bd97fc54cd41526 100644 (file)
@@ -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) {