diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-28 20:20:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-28 23:25:13 +0300 |
commit | 75a5173176adfc4bc417c10df137d9ea8d90d403 (patch) | |
tree | 2d095e72f084ff96ee5ce3608453d98da0eda5d7 /src/gui/windows | |
parent | b6831b3b3053b1777402a35d8b3ae3cca2f62bc4 (diff) | |
download | manaverse-75a5173176adfc4bc417c10df137d9ea8d90d403.tar.gz manaverse-75a5173176adfc4bc417c10df137d9ea8d90d403.tar.bz2 manaverse-75a5173176adfc4bc417c10df137d9ea8d90d403.tar.xz manaverse-75a5173176adfc4bc417c10df137d9ea8d90d403.zip |
Change memory allocation in Virtfs::LoadFile from calloc to new.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 6dbc03852..c4f085292 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -1070,11 +1070,12 @@ bool UpdaterWindow::validateFile(const std::string &filePath, unsigned long UpdaterWindow::getFileHash(const std::string &filePath) { int size = 0; - const char *const buf = static_cast<const char*>( - VirtFs::loadFile(filePath, size)); - if (!buf) + char *const buf = VirtFs::loadFile(filePath, size); + if (buf == nullptr) return 0; - return Net::Download::adlerBuffer(buf, size); + unsigned long res = Net::Download::adlerBuffer(buf, size); + delete [] buf; + return res; } void UpdaterWindow::loadFile(std::string file) |