Skip to content

Commit 6e57010

Browse files
authored
Merge pull request libgit2#5800 from mamapanda/check-sortedcache-lock
2 parents 935f851 + 3623252 commit 6e57010

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/refdb_fs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ static int loose_lookup_to_packfile(refdb_fs_backend *backend, const char *name)
254254
if ((error = loose_parse_oid(&oid, name, &ref_file)) < 0)
255255
goto done;
256256

257-
git_sortedcache_wlock(backend->refcache);
257+
if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
258+
goto done;
258259

259260
if (!(error = git_sortedcache_upsert(
260261
(void **)&ref, backend->refcache, name))) {
@@ -760,7 +761,8 @@ static int reference_path_available(
760761
}
761762
}
762763

763-
git_sortedcache_rlock(backend->refcache);
764+
if ((error = git_sortedcache_rlock(backend->refcache)) < 0)
765+
return error;
764766

765767
for (i = 0; i < git_sortedcache_entrycount(backend->refcache); ++i) {
766768
struct packref *ref = git_sortedcache_entry(backend->refcache, i);

0 commit comments

Comments
 (0)