From 75a5173176adfc4bc417c10df137d9ea8d90d403 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Mar 2017 20:20:54 +0300 Subject: Change memory allocation in Virtfs::LoadFile from calloc to new. --- src/gui/windows/updaterwindow.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/gui/windows') 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( - 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) -- cgit v1.2.3-70-g09d2