summaryrefslogtreecommitdiff
path: root/src/gui/windows/updaterwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-28 20:20:54 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-28 23:25:13 +0300
commit75a5173176adfc4bc417c10df137d9ea8d90d403 (patch)
tree2d095e72f084ff96ee5ce3608453d98da0eda5d7 /src/gui/windows/updaterwindow.cpp
parentb6831b3b3053b1777402a35d8b3ae3cca2f62bc4 (diff)
downloadmanaverse-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/updaterwindow.cpp')
-rw-r--r--src/gui/windows/updaterwindow.cpp9
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)