diff --git a/Source/Archive/MemMapPakFile.cpp b/Source/Archive/MemMapPakFile.cpp index 97ef73446..c25118f6e 100644 --- a/Source/Archive/MemMapPakFile.cpp +++ b/Source/Archive/MemMapPakFile.cpp @@ -129,10 +129,10 @@ std::uint8_t* CMemMapPakFile::Read(std::uint64_t offset, std::uint32_t length) { SetFilePointerEx(this->m_handle, position, nullptr, FILE_BEGIN); DWORD read = 0; - if (ReadFile(this->m_handle, this->m_buffer.data(), length, &read, nullptr)) { - this->m_view = this->m_buffer.empty() ? nullptr : this->m_buffer.data(); - return this->m_view; + if (!ReadFile(this->m_handle, this->m_buffer.data(), length, &read, nullptr)) { + return nullptr; } - return nullptr; + this->m_view = this->m_buffer.empty() ? nullptr : this->m_buffer.data(); + return this->m_view; } diff --git a/Source/Network/TextEncoding.cpp b/Source/Network/TextEncoding.cpp index 51df72686..8d52e1903 100644 --- a/Source/Network/TextEncoding.cpp +++ b/Source/Network/TextEncoding.cpp @@ -30,12 +30,11 @@ std::string CCURLMgr::ToUtf8(std::string text) { if (converted) { WideCharToMultiByte(CP_UTF8, 0, wide, -1, converted, length, nullptr, nullptr); - result.assign(converted, std::strlen(converted)); - _freea(converted); - } else { - result.assign(converted, std::strlen(converted)); } + result = converted; + _freea(converted); + SysFreeString(wide); }