update anti leak

This commit is contained in:
H3XploR
2025-02-25 00:18:36 +01:00
parent c50118cc1d
commit d3f205543e
5 changed files with 23 additions and 11 deletions
+14 -2
View File
@@ -6,7 +6,7 @@
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/17 19:22:27 by yantoine #+# #+# */
/* Updated: 2025/02/24 17:01:54 by yantoine ### ########.fr */
/* Updated: 2025/02/25 00:15:35 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,13 +17,25 @@ int key_press(int keycode, t_app *app)
(void)app;
printf("keycode: %d\n", keycode);
if (keycode == 53 || keycode == 65307)
{
mlx_destroy_image(app->mlx, app->img);
mlx_destroy_window(app->mlx, app->win);
mlx_destroy_display(app->mlx);
free(app->mlx);
exit(0);
}
return (0);
}
int handle_close(void *param)
{
(void)param;
t_app *app;
app = (t_app *)param;
mlx_destroy_image(app->mlx, app->img);
mlx_destroy_window(app->mlx, app->win);
mlx_destroy_display(app->mlx);
free(app->mlx);
exit(0);
return (0);
}