mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Fix a handful of memory leaks in the midend.
I happened to notice these when running dominosa --generate under Leak Sanitiser.
This commit is contained in:
7
midend.c
7
midend.c
@ -171,6 +171,8 @@ midend *midend_new(frontend *fe, const game *ourgame,
|
|||||||
me->params = ourgame->default_params();
|
me->params = ourgame->default_params();
|
||||||
me->game_id_change_notify_function = NULL;
|
me->game_id_change_notify_function = NULL;
|
||||||
me->game_id_change_notify_ctx = NULL;
|
me->game_id_change_notify_ctx = NULL;
|
||||||
|
me->encoded_presets = NULL;
|
||||||
|
me->n_encoded_presets = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow environment-based changing of the default settings by
|
* Allow environment-based changing of the default settings by
|
||||||
@ -261,8 +263,13 @@ static void midend_free_preset_menu(midend *me, struct preset_menu *menu)
|
|||||||
|
|
||||||
void midend_free(midend *me)
|
void midend_free(midend *me)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
midend_free_game(me);
|
midend_free_game(me);
|
||||||
|
|
||||||
|
for (i = 0; i < me->n_encoded_presets; i++)
|
||||||
|
sfree(me->encoded_presets[i]);
|
||||||
|
sfree(me->encoded_presets);
|
||||||
if (me->drawing)
|
if (me->drawing)
|
||||||
drawing_free(me->drawing);
|
drawing_free(me->drawing);
|
||||||
random_free(me->random);
|
random_free(me->random);
|
||||||
|
Reference in New Issue
Block a user