free memory myself

This commit is contained in:
Akash Mozumdar 2018-07-30 00:47:09 -07:00
parent 7a39c40936
commit b5eef8b3fe

View File

@ -53,7 +53,12 @@ std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_
strcpy(miscInfoTraverser->propertyName, "END");
miscInfoTraverser->nextProperty = nullptr;
for (auto i : extensions)
{
const wchar_t* prev = sentenceBuffer;
sentenceBuffer = i.second(sentenceBuffer, miscInfoLinkedList);
if (sentenceBuffer == nullptr) sentence = prev;
if (sentenceBuffer != prev) delete[] prev;
}
miscInfoTraverser = miscInfoLinkedList;
while (miscInfoTraverser != nullptr)
{