aboutsummaryrefslogtreecommitdiff
path: root/src/FileUtils.cpp
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-05-16 11:00:10 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-05-16 11:00:14 +0200
commit05920c5c5ffcedc435eeee29f6357c6b4fdc9c4f (patch)
tree4b6584fe051fe31519c50b48dc59249871f8e59e /src/FileUtils.cpp
parent7f19b686cc7b47346ba8bab89bb34188f366db10 (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 };