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:
Asher Gordon
2023-07-29 15:27:46 -04:00
committed by Simon Tatham
parent 9e4e15fda2
commit 3e7a6adce5

View File

@ -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;
} }