From: Holger Schemel Date: Mon, 3 Sep 2018 21:33:02 +0000 (+0200) Subject: fixed bug with overwriting level file info from level template X-Git-Tag: 4.1.1.0~44 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=84e1915b7518d611e0379f926691a0b1f7a9e430;p=rocksndiamonds.git fixed bug with overwriting level file info from level template This bug (which was causing crashes due to double free()ing strings) was a nasty side effect of changing string pointers in the file info structure from using string references (allocated and freed somewhere else) to copies of strings allocated and freed for each change, while still copying the file info from the level template over to the file info of the level file in function "ActivateLevelTemplate()" (causing duplicates of string pointers which were therefore freed twice). This bug was most probably the real cause for the problems fixed by the changes in commit 759e0bea. --- diff --git a/src/files.c b/src/files.c index efbc26f8..21bede9a 100644 --- a/src/files.c +++ b/src/files.c @@ -1915,6 +1915,9 @@ static void ActivateLevelTemplate() /* overwrite all individual level settings from template level settings */ level = level_template; + /* restore level file info */ + level.file_info = level_backup.file_info; + /* restore playfield size */ level.fieldx = level_backup.fieldx; level.fieldy = level_backup.fieldy;