mirror of
https://github.com/opencv/opencv.git
synced 2025-08-05 22:19:14 +08:00
Merge pull request #20293 from endjkv:fix-mem-leak-when-throw
* fix memory leak when exception is thrown
This commit is contained in:
parent
c95a56450d
commit
42d644ef91
@ -1835,7 +1835,15 @@ void* TLSDataContainer::getData() const
|
||||
{
|
||||
// Create new data instance and save it to TLS storage
|
||||
pData = createDataInstance();
|
||||
getTlsStorage().setData(key_, pData);
|
||||
try
|
||||
{
|
||||
getTlsStorage().setData(key_, pData);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
deleteDataInstance(pData);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return pData;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user