diff options
| author | Simon Tatham <anakin@pobox.com> | 2019-04-05 19:29:23 +0100 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2019-04-05 19:29:23 +0100 |
| commit | 7f00725c978bf79de91951f143cdfd2f9173041d (patch) | |
| tree | bedf416382a63861089fa4aede435beacf71fdc7 /midend.c | |
| parent | 5c4d6b8f35e749b269907fd2cdaacc117198807b (diff) | |
| download | puzzles-7f00725c978bf79de91951f143cdfd2f9173041d.zip puzzles-7f00725c978bf79de91951f143cdfd2f9173041d.tar.gz puzzles-7f00725c978bf79de91951f143cdfd2f9173041d.tar.bz2 puzzles-7f00725c978bf79de91951f143cdfd2f9173041d.tar.xz | |
Fix a handful of memory leaks in the midend.
I happened to notice these when running dominosa --generate under Leak
Sanitiser.
Diffstat (limited to 'midend.c')
| -rw-r--r-- | midend.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -171,6 +171,8 @@ midend *midend_new(frontend *fe, const game *ourgame, me->params = ourgame->default_params(); me->game_id_change_notify_function = 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 @@ -261,8 +263,13 @@ static void midend_free_preset_menu(midend *me, struct preset_menu *menu) void midend_free(midend *me) { + int i; + 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) drawing_free(me->drawing); random_free(me->random); |