- 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,16 +394,20 @@ 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
FloatRect * rcs = new FloatRect[gapc];
for(x=0;x<gapc;x++)
if (gapc > 0)
{
// gaps are stored as texture (u/v) coordinates
rcs[x].width=rcs[x].left=-1.0f;
rcs[x].top=(float)gaps[x][0]/(float)h;
rcs[x].height=(float)gaps[x][1]/(float)h;
FloatRect * rcs = new FloatRect[gapc];
for (x = 0; x < gapc; x++)
{
// gaps are stored as texture (u/v) coordinates
rcs[x].width = rcs[x].left = -1.0f;
rcs[x].top = (float)gaps[x][0] / (float)h;
rcs[x].height = (float)gaps[x][1] / (float)h;
}
gl_info.areas = rcs;
}
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;