- fixed a few memory leaks.

This commit is contained in:
Christoph Oelckers 2017-01-11 11:37:27 +01:00
parent 72101473d0
commit 7f3e18a6cc
4 changed files with 19 additions and 23 deletions

View file

@ -483,7 +483,7 @@ FTextureID gl_GetSpriteFrame(unsigned sprite, int frame, int rot, angle_t ang, b
//==========================================================================
//
// Recalculate all heights affectting this vertex.
// Recalculate all heights affecting this vertex.
//
//==========================================================================
void gl_RecalcVertexHeights(vertex_t * v)

View file

@ -623,20 +623,6 @@ void gl_CleanLevelData()
mo=next;
}
for(auto &v : level.vertexes) if (v.numsectors > 0)
{
if (v.sectors != nullptr)
{
delete [] v.sectors;
v.sectors = nullptr;
}
if (v.heightlist != nullptr)
{
delete [] v.heightlist;
v.heightlist = nullptr;
}
}
if (level.sides.Size() > 0 && level.sides[0].segs)
{
delete [] level.sides[0].segs;

View file

@ -394,6 +394,8 @@ bool FTexture::FindHoles(const unsigned char * buffer, int w, int h)
}
if (startdraw==0 && lendraw==h) return false; // nothing saved so don't create a split list
if (gapc > 0)
{
FloatRect * rcs = new FloatRect[gapc];
for (x = 0; x < gapc; x++)
@ -404,6 +406,8 @@ bool FTexture::FindHoles(const unsigned char * buffer, int w, int h)
rcs[x].height = (float)gaps[x][1] / (float)h;
}
gl_info.areas = rcs;
}
else gl_info.areas = nullptr;
gl_info.areacount=gapc;
return true;

View file

@ -157,6 +157,12 @@ struct vertex_t
heightlist = NULL;
}
~vertex_t()
{
if (sectors != nullptr) delete[] sectors;
if (heightlist != nullptr) delete[] heightlist;
}
bool operator== (const vertex_t &other)
{
return p == other.p;