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. 8
      modules/core/src/system.cpp

@ -1835,8 +1835,16 @@ void* TLSDataContainer::getData() const
{
// Create new data instance and save it to TLS storage
pData = createDataInstance();
try
{
getTlsStorage().setData(key_, pData);
}
catch (...)
{
deleteDataInstance(pData);
throw;
}
}
return pData;
}

Loading…
Cancel
Save