refdb: unlock mutex on assertion failure If we're safely asserting (and returning an error to the caller), we should still unlock our mutex.
diff --git a/src/libgit2/refdb_fs.c b/src/libgit2/refdb_fs.c
index 95bda94..ef85016 100644
--- a/src/libgit2/refdb_fs.c
+++ b/src/libgit2/refdb_fs.c
@@ -1361,7 +1361,11 @@ 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);
- GIT_ASSERT(ref);
+
+ GIT_ASSERT_WITH_CLEANUP(ref, {
+ error = -1;
+ goto fail;
+ });
if ((error = packed_find_peel(backend, ref)) < 0)
goto fail;