diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f76039730..ed96483ad 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,6 +1,12 @@ May 9, 2006 (Changes by Graf Zahl) -- Changed FDoorAnimation deletion so that the array takes care of it. This - eliminates some complications with the requirements a destructor has. +- Fixed: The FSpecialFont constructor created the name string twice. +- Fixed: The animated door parser was still leaking memory when it encountered + an invalid animation due to missing textures. +- Fixed: The music volume list wasn't freed. +- Fixed: The image for WADs that were loaded from inside Zips was never freed. +- Changed FDoorAnimation deletion so that the array takes care of it. The + original destructor approach would have necessitated a lot more supporting + code to work as intended. - Fixed: Skin definitions were never freed. - Fixed: Names in terrain definitions were never freed. Replacing them with FNames would have been a good idea anyway. diff --git a/src/p_doors.cpp b/src/p_doors.cpp index c995497f0..d06b6a4f7 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -856,11 +856,16 @@ void P_ParseAnimatedDoor() break; } } - anim.TextureFrames = new int[frames.Size()]; - memcpy (anim.TextureFrames, &frames[0], sizeof(int) * frames.Size()); - anim.NumTextureFrames = frames.Size(); if (!error) { + anim.TextureFrames = new int[frames.Size()]; + memcpy (anim.TextureFrames, &frames[0], sizeof(int) * frames.Size()); + anim.NumTextureFrames = frames.Size(); DoorAnimations.Push (anim); } + else + { + if (anim.OpenSound!=NULL) delete [] anim.OpenSound; + if (anim.CloseSound!=NULL) delete [] anim.CloseSound; + } } diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index defe241b6..a3cc7a47a 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -210,6 +210,19 @@ static const char *SICommandStrings[] = static TArray S_rnd; static FMusicVolume *MusicVolumes; +static struct MusicVolumeDeleter +{ + ~MusicVolumeDeleter() + { + while(MusicVolumes!=NULL) + { + FMusicVolume * next = MusicVolumes->Next; + free(MusicVolumes); + MusicVolumes=next; + } + } +} DeleteTheMusicVolumes; + static int NumPlayerReserves; static bool DoneReserving; static bool PlayerClassesIsSorted; diff --git a/src/v_font.cpp b/src/v_font.cpp index 3d604d247..406ff0408 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -1138,7 +1138,6 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, int *lumplis FontHeight = 0; GlobalKerning = false; memset (usedcolors, 0, 256); - Name = copystring (name); Next = FirstFont; FirstFont = this; diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 2d77470fd..6e3c57ebc 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -1938,6 +1938,10 @@ FWadCollection::WadFileRecord::~WadFileRecord () { delete[] Name; } + if (MemoryData != NULL) + { + delete [] MemoryData; + } } long FWadCollection::WadFileRecord::Seek (long offset, int origin)