From 58e28673bca34fa9f89f4b4d07561aa445f06c7c Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Mon, 16 Mar 2026 09:14:39 +0100 Subject: [PATCH] For some reason there was a malloc in os_read --- build.sh | 3 ++- src/os/os.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 5749c68..22e577a 100644 --- a/build.sh +++ b/build.sh @@ -4,6 +4,7 @@ if [ ! -d build ]; then mkdir build fi cd build -clang $(realpath ../src/testing/testing_main.c) -o testing_main -I../src -g -Wall -Wextra -Werror -fdiagnostics-absolute-paths -Wno-single-bit-bitfield-constant-conversion -Wno-unsequenced -Wno-missing-field-initializers -Wno-missing-braces -ldl -lm -lbacktrace +clang $(realpath ../src/testing/testing_main.c) -o testing_main -I../src -g -Wall -Wextra -Werror -fdiagnostics-absolute-paths -Wno-single-bit-bitfield-constant-conversion -Wno-unsequenced -Wno-missing-field-initializers -Wno-missing-braces -fsanitize=address,undefined -fno-omit-frame-pointer -ldl -lm -lbacktrace + ./testing_main cd .. diff --git a/src/os/os.c b/src/os/os.c index 00a0437..a94e39b 100644 --- a/src/os/os.c +++ b/src/os/os.c @@ -550,7 +550,7 @@ fn s8_t os_read(ma_arena_t *arena, s8_t path) { fseek(fd, 0, SEEK_END); long size = ftell(fd); fseek(fd, 0, SEEK_SET); - char *string = malloc(size + 1); + char *string = ma_push_array(arena, char, size + 1); fread(string, size, 1, fd); fclose(fd);