mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
midend_get_prefs: Don't free memory that we just copied elsewhere.
We were using free_cfg(be_prefs) after we copied be_prefs to all_prefs, but we actually want to use sfree(be_prefs) since we don't want to free each element that has been copied. None of the games so far use string preferences, which is why they haven't been affected by this bug.
This commit is contained in:

committed by
Simon Tatham

parent
9e4e15fda2
commit
3e7a6adce5
4
midend.c
4
midend.c
@ -2937,7 +2937,9 @@ static config_item *midend_get_prefs(midend *me, game_ui *ui)
|
|||||||
all_prefs[pos].type = C_END;
|
all_prefs[pos].type = C_END;
|
||||||
|
|
||||||
if (be_prefs)
|
if (be_prefs)
|
||||||
free_cfg(be_prefs);
|
/* We already copied each element, so don't free those with
|
||||||
|
free_cfg(). */
|
||||||
|
sfree(be_prefs);
|
||||||
|
|
||||||
return all_prefs;
|
return all_prefs;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user