Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d3ee96

Browse files
pks-tEdward Thomson
authored and
Edward Thomson
committed
refdb_fs: fail if refcache returns NULL pointer
We usually check entries returned by `git_sortedcache_entry` for NULL pointers. As we have a write lock in `packed_write`, though, it really should not happen that the function returns NULL. Assert that ref is not NULL to silence a Coverity warning.
1 parent 0b357e2 commit 8d3ee96

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/refdb_fs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ static int packed_write(refdb_fs_backend *backend)
962962

963963
for (i = 0; i < git_sortedcache_entrycount(refcache); ++i) {
964964
struct packref *ref = git_sortedcache_entry(refcache, i);
965+
assert(ref);
965966

966967
if (packed_find_peel(backend, ref) < 0)
967968
goto fail;

0 commit comments

Comments
 (0)