diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-06-06 13:45:14 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-06-06 15:38:17 +0300 |
commit | 4a52531a11fa27da36f9dbe849ecf0573f35a47b (patch) | |
tree | 029025a9a21cf598ac8a064bd30025d9e8bd21ef /source/blender/blenkernel/intern/cachefile.c | |
parent | 4c4fa3d49bc1988336620fd503d8b43d7885dbcb (diff) |
Alembic: Fix double-free of mutex
The mutex was shared between CoW copies of the CacheFile datablock, and
as a result also freed multiple times. It is now only freed when the
original datablock is freed; the CoW copies share the same mutex.
Diffstat (limited to 'source/blender/blenkernel/intern/cachefile.c')
-rw-r--r-- | source/blender/blenkernel/intern/cachefile.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c index 274f7b78529..89c6fad086d 100644 --- a/source/blender/blenkernel/intern/cachefile.c +++ b/source/blender/blenkernel/intern/cachefile.c @@ -93,7 +93,9 @@ void BKE_cachefile_free(CacheFile *cache_file) ABC_free_handle(cache_file->handle); #endif - if (cache_file->handle_mutex) { + /* CoW copies share the mutex, so it should only be freed if the original + * CacheFile datablock is freed. */ + if (cache_file->handle_mutex && (cache_file->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0) { BLI_mutex_free(cache_file->handle_mutex); } BLI_freelistN(&cache_file->object_paths); |