Fix #120763: Fix memory leak in itasc cache

`Cache::addChannel` would return early when new cache entry insertion
isn't success, but the newly created cache entry isn't deleted upon
return, this patch fixes this.

Pull Request: https://projects.blender.org/blender/blender/pulls/120766
This commit is contained in:
YimingWu 2024-04-24 09:35:04 +02:00 committed by YimingWu
parent 7f2c0311fc
commit ab72da8b5c

@ -214,8 +214,10 @@ int Cache::addChannel(const void *device, const char *name, unsigned int maxItem
entry = new CacheEntry();
if (entry == NULL)
return -1;
if (!m_cache.insert(CacheMap::value_type(device,entry)).second)
if (!m_cache.insert(CacheMap::value_type(device,entry)).second) {
delete entry;
return -1;
}
} else {
entry = it->second;
}