aboutsummaryrefslogtreecommitdiff
path: root/src/FileUtils.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-16 11:00:10 +0200
committerdec05eba <dec05eba@protonmail.com>2020-08-18 23:25:46 +0200
commit627bd655347cb3aaf04b352e4f0a0207d64c8cb1 (patch)
treeb45b2a341b1e5675f8af3662e5a124fcf6093d4e /src/FileUtils.cpp
parent97c9ff702f002925dcd33869d0e22eda18390e2e (diff)
Fix memory leak (mismatch free/delete/delete[]), fix invalid memory access
Diffstat (limited to 'src/FileUtils.cpp')
-rw-r--r--src/FileUtils.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/FileUtils.cpp b/src/FileUtils.cpp
index c4fb318..28bce29 100644
--- a/src/FileUtils.cpp
+++ b/src/FileUtils.cpp
@@ -5,7 +5,7 @@ using namespace std;
namespace odhtdb
{
- OwnedMemory fileGetContent(const boost::filesystem::path &filepath)
+ OwnedByteArray fileGetContent(const boost::filesystem::path &filepath)
{
#if OS_FAMILY == OS_FAMILY_POSIX
FILE *file = fopen(filepath.string().c_str(), "rb");
@@ -27,7 +27,7 @@ namespace odhtdb
size_t fileSize = ftell(file);
fseek(file, 0, SEEK_SET);
- char *result = new char[fileSize];
+ u8 *result = new u8[fileSize];
fread(result, 1, fileSize, file);
fclose(file);
return { result, fileSize };