mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-21 07:08:34 +00:00
Merge pull request #924 from schu/cache-fix-race-cond
cache: fix race condition
This commit is contained in:
commit
5a409c44ba
@ -89,12 +89,13 @@ void *git_cache_try_store(git_cache *cache, void *_entry)
|
|||||||
git_cached_obj_decref(node, cache->free_obj);
|
git_cached_obj_decref(node, cache->free_obj);
|
||||||
cache->nodes[hash & cache->size_mask] = entry;
|
cache->nodes[hash & cache->size_mask] = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* increase the refcount again, because we are
|
||||||
|
* returning it to the user */
|
||||||
|
git_cached_obj_incref(entry);
|
||||||
|
|
||||||
}
|
}
|
||||||
git_mutex_unlock(&cache->lock);
|
git_mutex_unlock(&cache->lock);
|
||||||
|
|
||||||
/* increase the refcount again, because we are
|
|
||||||
* returning it to the user */
|
|
||||||
git_cached_obj_incref(entry);
|
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user