Skip to content

Commit 043a87a

Browse files
committed
refdb: unlock mutex on assertion failure
If we're safely asserting (and returning an error to the caller), we should still unlock our mutex.
1 parent d9b041e commit 043a87a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libgit2/refdb_fs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,11 @@ static int packed_write(refdb_fs_backend *backend)
13611361

13621362
for (i = 0; i < git_sortedcache_entrycount(refcache); ++i) {
13631363
struct packref *ref = git_sortedcache_entry(refcache, i);
1364-
GIT_ASSERT(ref);
1364+
1365+
GIT_ASSERT_WITH_CLEANUP(ref, {
1366+
error = -1;
1367+
goto fail;
1368+
});
13651369

13661370
if ((error = packed_find_peel(backend, ref)) < 0)
13671371
goto fail;

0 commit comments

Comments
 (0)