diff --git a/core/logic/CDataPack.cpp b/core/logic/CDataPack.cpp index 16b1a34d..d794e379 100644 --- a/core/logic/CDataPack.cpp +++ b/core/logic/CDataPack.cpp @@ -65,12 +65,13 @@ CDataPack::Free(CDataPack *pack) void CDataPack::Initialize() { + position = 0; + do { } while (this->RemoveItem()); elements.clear(); - position = 0; } void CDataPack::ResetSize() @@ -214,6 +215,7 @@ bool CDataPack::RemoveItem(size_t pos) { pos = position; } + if (pos >= elements.length()) { return false; @@ -228,7 +230,7 @@ bool CDataPack::RemoveItem(size_t pos) { case CDataPackType::Raw: { - delete elements[pos].pData.vval; + delete [] elements[pos].pData.vval; break; }