mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Fix memory leak in convert_tilesize
If old_dpr == new_dpr, convert_tilesize returns early without freeing defaults. Move the initialisation of defaults after this special case.
This commit is contained in:

committed by
Ben Harris

parent
4b5422181d
commit
1dc1ed786f
5
midend.c
5
midend.c
@ -321,10 +321,13 @@ static int convert_tilesize(midend *me, int old_tilesize,
|
|||||||
double old_dpr, double new_dpr)
|
double old_dpr, double new_dpr)
|
||||||
{
|
{
|
||||||
int x, y, rx, ry, min, max;
|
int x, y, rx, ry, min, max;
|
||||||
game_params *defaults = me->ourgame->default_params();
|
game_params *defaults;
|
||||||
|
|
||||||
if (new_dpr == old_dpr)
|
if (new_dpr == old_dpr)
|
||||||
return old_tilesize;
|
return old_tilesize;
|
||||||
|
|
||||||
|
defaults = me->ourgame->default_params();
|
||||||
|
|
||||||
me->ourgame->compute_size(defaults, old_tilesize, &x, &y);
|
me->ourgame->compute_size(defaults, old_tilesize, &x, &y);
|
||||||
x *= new_dpr / old_dpr;
|
x *= new_dpr / old_dpr;
|
||||||
y *= new_dpr / old_dpr;
|
y *= new_dpr / old_dpr;
|
||||||
|
Reference in New Issue
Block a user