Delete initializer, if it could not be stored.

This commit is contained in:
LoRd_MuldeR 2017-11-04 19:08:49 +01:00
parent cea3834ddf
commit e3f5f0a801

View File

@ -52,9 +52,9 @@ namespace MUtils
{ {
if (T *const initializer = create()) if (T *const initializer = create())
{ {
if (m_data.testAndSetOrdered(NULL, initializer)) if (!m_data.testAndSetOrdered(NULL, initializer))
{ {
return *initializer; delete initializer;
} }
} }
else else