fix variout memory leaks

This commit is contained in:
veclav talica 2024-10-01 13:34:58 +03:00
parent 9ab7d1edff
commit 91ea5356fc
3 changed files with 5 additions and 2 deletions

View File

@ -181,7 +181,7 @@ void input_state_init(InputState *input) {
void input_state_deinit(InputState *input) { void input_state_deinit(InputState *input) {
shfree(input->action_hash); input_reset_state(input);
} }

View File

@ -538,6 +538,8 @@ static void clean_up(void) {
text_cache_deinit(&ctx.text_cache); text_cache_deinit(&ctx.text_cache);
textures_cache_deinit(&ctx.texture_cache); textures_cache_deinit(&ctx.texture_cache);
textures_reset_state();
arrfree(ctx.render_queue_2d); arrfree(ctx.render_queue_2d);
toml_free(ctx.config_table); toml_free(ctx.config_table);

View File

@ -60,6 +60,7 @@ SDL_Surface *textures_load_surface(const char *path) {
int width, height, channels; int width, height, channels;
void *image_mem = stbi_load_from_callbacks(&callbacks, &context, &width, &height, &channels, 0); void *image_mem = stbi_load_from_callbacks(&callbacks, &context, &width, &height, &channels, 0);
SDL_FreeRW(handle);
if (!image_mem) if (!image_mem)
goto ERR_CANNOT_READ_IMAGE; goto ERR_CANNOT_READ_IMAGE;