From 187bfdac65fd952f39b7f6cb985c4fed0cb4de5d Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 5 Mar 2022 21:57:19 +0100 Subject: [PATCH] Use a properly aligned buffer for reading files --- src/utils/FileUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/FileUtils.cpp b/src/utils/FileUtils.cpp index 8e80605..f7b5b32 100644 --- a/src/utils/FileUtils.cpp +++ b/src/utils/FileUtils.cpp @@ -23,7 +23,7 @@ int32_t LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) uint32_t filesize = lseek(iFd, 0, SEEK_END); lseek(iFd, 0, SEEK_SET); - auto *buffer = (uint8_t *) malloc(ROUNDUP(filesize, 0x40)); + auto *buffer = (uint8_t *) memalign(0x40, ROUNDUP(filesize, 0x40)); if (buffer == nullptr) { close(iFd); return -2;