From 05920c5c5ffcedc435eeee29f6357c6b4fdc9c4f Mon Sep 17 00:00:00 2001 From: dec05eba <0xdec05eba@gmail.com> Date: Wed, 16 May 2018 11:00:10 +0200 Subject: Fix memory leak (mismatch free/delete/delete[]), fix invalid memory access --- src/FileUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/FileUtils.cpp') 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 }; -- cgit v1.2.3