diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b77d547d2..d1edee92a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20101204 +-------- +main/bmread.c, main/piggy.c: When setting a bogus sound in gamedata_read_tbl, don't let piggy_close free it. Fixes freeing of non-malloc'd pointer for PC shareware data + 20101203 -------- main/net_udp.c: Made resent_delay for net_udp_noloss_process_queue() a bit longer depending on the player's ping diff --git a/main/bmread.c b/main/bmread.c index a560e50a1..23c4cdc22 100644 --- a/main/bmread.c +++ b/main/bmread.c @@ -285,7 +285,9 @@ int ds_load(int skip, char * filename ) { char rawname[100]; if (skip) { - return piggy_register_sound( &bogus_sound, "bogus", 0 ); + // We tell piggy_register_sound it's in the pig file, when in actual fact it's in no file + // This just tells piggy_close not to attempt to free it + return piggy_register_sound( &bogus_sound, "bogus", 1 ); } removeext( filename, fname ); diff --git a/main/piggy.c b/main/piggy.c index d10b7d0e5..0ae6584f6 100644 --- a/main/piggy.c +++ b/main/piggy.c @@ -211,6 +211,8 @@ int piggy_register_sound( digi_sound * snd, char * name, int in_file ) if ( !in_file ) { SoundOffset[Num_sound_files] = 0; } + else if (SoundOffset[Num_sound_files] == 0) + SoundOffset[Num_sound_files] = -1; // make sure this sound's data is not individually freed i = Num_sound_files;