revolver

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit b5019b02c3476ebda08e084ba680a261a1fec371
parent 166d4efb81c22007037c4a37c4882ecb1d75d7f3
Author: Samdal <samdal@protonmail.com>
Date:   Tue, 25 Mar 2025 19:49:10 +0100

don't leak stb_image memory

Diffstat:
Mbuild.sh | 4++--
Msrc/util/util_tex_load.c | 2++
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/build.sh b/build.sh @@ -38,7 +38,7 @@ compiler_flags=( -Isrc/ - -DRV_WIN_X11=0 + #-DRV_WIN_X11=0 -D_GNU_SOURCE=1 ) common_flags=( @@ -47,7 +47,7 @@ common_flags=( linker_flags=( -lm -lxcb -lxcb-xkb -lEGL -lGL - -lX11 -lXi + #-lX11 -lXi -fuse-ld=mold ) diff --git a/src/util/util_tex_load.c b/src/util/util_tex_load.c @@ -2,6 +2,7 @@ // util_tex_load.c #define STB_IMAGE_IMPLEMENTATION +#define STB_IMAGE_STATIC #include "../external/stb_image.h" RV_GLOBAL rv_texture_t* rv_tex_load_from_file(rv_arena* arena, rv_str8 filename, bool32 vertical_flip_on_load) @@ -25,6 +26,7 @@ RV_GLOBAL rv_texture_t* rv_tex_load_from_memory(rv_arena* arena, rv_str8 memory, if (data) { res->size = rv_v2(width, height); res->data = rv_mem_copy(rv_arena_push(arena, 4 * width * height, 8), data, 4 * width * height); + stbi_image_free(data); } else { // set default texture... rv_unreachable();