From 627bd655347cb3aaf04b352e4f0a0207d64c8cb1 Mon Sep 17 00:00:00 2001 From: dec05eba 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