mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
midend_request_keys: fix memory leak of a game_params.
Thanks to Steffen Bauer for spotting this. The call to midend_get_params(me) was making a duplicate of me->params, and nothing was freeing it. Since the game_params is passed to request_keys as a const pointer, it should be safe to pass me->params itself, so that instead of adding a free, we can remove the unnecessary allocation.
This commit is contained in:
2
midend.c
2
midend.c
@ -1271,7 +1271,7 @@ key_label *midend_request_keys(midend *me, int *n)
|
|||||||
|
|
||||||
if(me->ourgame->request_keys)
|
if(me->ourgame->request_keys)
|
||||||
{
|
{
|
||||||
keys = me->ourgame->request_keys(midend_get_params(me), &nkeys);
|
keys = me->ourgame->request_keys(me->params, &nkeys);
|
||||||
for(i = 0; i < nkeys; ++i)
|
for(i = 0; i < nkeys; ++i)
|
||||||
{
|
{
|
||||||
if(!keys[i].label)
|
if(!keys[i].label)
|
||||||
|
Reference in New Issue
Block a user