diff options
author | Patrick Steinhardt <ps@pks.im> | 2016-03-10 16:11:51 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2016-03-11 14:20:15 +0100 |
commit | b27ccad274a861415517f5b35800a45a32535e14 (patch) | |
tree | 57868e7f58816296b6b1b6272bf366de672409dc /src/refdb_fs.c | |
parent | 2ba9a0ddacd315dafb54990ff2bfa204e6924016 (diff) | |
download | libgit2-b27ccad274a861415517f5b35800a45a32535e14.tar.gz |
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.
Diffstat (limited to 'src/refdb_fs.c')
-rw-r--r-- | src/refdb_fs.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c index f6ed7201a..f978038e6 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -962,6 +962,7 @@ static int packed_write(refdb_fs_backend *backend) for (i = 0; i < git_sortedcache_entrycount(refcache); ++i) { struct packref *ref = git_sortedcache_entry(refcache, i); + assert(ref); if (packed_find_peel(backend, ref) < 0) goto fail; |