Merge pull request #20293 from endjkv:fix-mem-leak-when-throw

* fix memory leak when exception is thrown
pull/18337/merge
xzvno 3 years ago committed by GitHub
parent c95a56450d
commit 42d644ef91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      modules/core/src/system.cpp

@ -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…
Cancel
Save