fix memory leaks

This commit is contained in:
Akash Mozumdar 2018-08-22 13:22:37 -04:00
parent 5984ae514b
commit 29eb1dcfe6
2 changed files with 2 additions and 1 deletions

View File

@ -33,7 +33,7 @@ std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_
wcscpy(sentenceBuffer, sentence.c_str()); wcscpy(sentenceBuffer, sentence.c_str());
InfoForExtension* miscInfoLinkedList = new InfoForExtension; InfoForExtension* miscInfoLinkedList = new InfoForExtension;
InfoForExtension* miscInfoTraverser = miscInfoLinkedList; InfoForExtension* miscInfoTraverser = miscInfoLinkedList;
for (auto& i : miscInfo) miscInfoTraverser = miscInfoTraverser->nextProperty = new InfoForExtension{ i.first.c_str(), i.second, new InfoForExtension }; for (auto& i : miscInfo) miscInfoTraverser = miscInfoTraverser->nextProperty = new InfoForExtension{ i.first.c_str(), i.second, nullptr };
extenMutex.lock_shared(); extenMutex.lock_shared();
for (auto i : extensions) for (auto i : extensions)
{ {

View File

@ -25,6 +25,7 @@ std::wstring GetTranslationUri(const wchar_t* text, unsigned int TKK)
a %= 1000000; a %= 1000000;
b ^= a; b ^= a;
delete[] utf8text;
return std::wstring(L"/translate_a/single?client=t&dt=ld&dt=rm&dt=t&tk=") + std::to_wstring(a) + L"." + std::to_wstring(b) + L"&q=" + std::wstring(text); return std::wstring(L"/translate_a/single?client=t&dt=ld&dt=rm&dt=t&tk=") + std::to_wstring(a) + L"." + std::to_wstring(b) + L"&q=" + std::wstring(text);
} }