From: Holger Schemel Date: Wed, 20 Jan 2021 23:02:14 +0000 (+0100) Subject: fixed memory leak in recently added "last played level sets" feature X-Git-Tag: 4.2.3.0~40 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6d1d252c9b85dc2c6c847c387f40c60b6735ab0d;p=rocksndiamonds.git fixed memory leak in recently added "last played level sets" feature --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 718259ef..478f214f 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -4508,7 +4508,7 @@ void LoadLevelSetup_LastSeries(void) leveldir_current = getFirstValidTreeInfoEntry(leveldir_first); // start with empty history of last played level sets - setup.level_setup.last_level_series[0] = NULL; + setString(&setup.level_setup.last_level_series[0], NULL); if (!strEqual(DEFAULT_LEVELSET, UNDEFINED_LEVELSET)) { @@ -4540,11 +4540,11 @@ void LoadLevelSetup_LastSeries(void) leveldir_last = getTreeInfoFromIdentifier(leveldir_first, last_level_series); if (leveldir_last != NULL) - setup.level_setup.last_level_series[pos++] = - getStringCopy(last_level_series); + setString(&setup.level_setup.last_level_series[pos++], + last_level_series); } - setup.level_setup.last_level_series[pos] = NULL; + setString(&setup.level_setup.last_level_series[pos], NULL); freeSetupFileHash(level_setup_hash); }