fix a bit of memory leak

This commit is contained in:
Théophyl Hoguet committed 2022-03-18 19:13:27 +01:00
1 parent f763238a4e
commit aaca2d2ae7
2 files changed
+5 -7

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ target_link_libraries(game_solve game)
# game_sdl # game_sdl
include_directories(${SDL2_ALL_INC}) include_directories(${SDL2_ALL_INC})
add_executable(game_sdl main.c model.c) add_executable(game_sdl main.c model.c)
target_link_libraries(game_sdl game ${SDL2_ALL_LIBS} m) target_link_libraries(game_sdl game ${SDL2_ALL_LIBS})
# libgame # libgame
add_library (game game.c game_aux.c game_ext.c game_private.c history.c game_tools.c game_examples.c) add_library (game game.c game_aux.c game_ext.c game_private.c history.c game_tools.c game_examples.c)
+4 -6
View File
@@ -392,17 +392,12 @@ void render(SDL_Window* win, SDL_Renderer* ren, Env* env) {
bool process(SDL_Window* win, Env* env, SDL_Event* e) { bool process(SDL_Window* win, Env* env, SDL_Event* e) {
int w, h; int w, h;
SDL_GetWindowSize(win, &w, &h); SDL_GetWindowSize(win, &w, &h);
if (e->type == SDL_QUIT) { if (e->type == SDL_QUIT) {
return true; return true;
} }
#ifdef _ANDROID_ #ifdef _ANDROID_
#else #else
if (e->type == SDL_MOUSEMOTION) {
else if (e->type == SDL_WINDOWEVENT) {
} else if (e->type == SDL_MOUSEMOTION) {
SDL_Point mouse; SDL_Point mouse;
SDL_GetMouseState(&mouse.x, &mouse.y); SDL_GetMouseState(&mouse.x, &mouse.y);
if (SDL_PointInRect(&mouse, env->rec_restart)) { if (SDL_PointInRect(&mouse, env->rec_restart)) {
@@ -477,6 +472,9 @@ void clean(Env* env) {
SDL_DestroyTexture(env->one[0]); SDL_DestroyTexture(env->one[0]);
SDL_DestroyTexture(env->one[1]); SDL_DestroyTexture(env->one[1]);
free(env->one); free(env->one);
SDL_DestroyTexture(env->two[0]);
SDL_DestroyTexture(env->two[1]);
free(env->two);
SDL_DestroyTexture(env->three[0]); SDL_DestroyTexture(env->three[0]);
SDL_DestroyTexture(env->three[1]); SDL_DestroyTexture(env->three[1]);
free(env->three); free(env->three);