mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 12:31:32 +00:00
Fix memory leak
This commit is contained in:
parent
1a677a341f
commit
a9035f6abc
1 changed files with 9 additions and 1 deletions
|
@ -505,7 +505,7 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
block = Z_Malloc(blocksize+1, PU_STATIC, &texturecache[texnum]);
|
block = Z_Malloc(blocksize+1, PU_STATIC, &texturecache[texnum]);
|
||||||
|
|
||||||
if (format == PICFMT_PATCH32)
|
if (format == PICFMT_PATCH32)
|
||||||
memset(block, 0x00000000, blocksize+1);
|
memset(block, 0x00, blocksize+1);
|
||||||
else
|
else
|
||||||
memset(block, TRANSPARENTPIXEL, blocksize+1); // Transparency hack
|
memset(block, TRANSPARENTPIXEL, blocksize+1); // Transparency hack
|
||||||
|
|
||||||
|
@ -560,10 +560,18 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
x2 = x1 + width;
|
x2 = x1 + width;
|
||||||
|
|
||||||
if (x1 > texture->width || x2 < 0)
|
if (x1 > texture->width || x2 < 0)
|
||||||
|
{
|
||||||
|
if (dealloc)
|
||||||
|
Z_Free(realpatch);
|
||||||
continue; // patch not located within texture's x bounds, ignore
|
continue; // patch not located within texture's x bounds, ignore
|
||||||
|
}
|
||||||
|
|
||||||
if (patch->originy > texture->height || (patch->originy + height) < 0)
|
if (patch->originy > texture->height || (patch->originy + height) < 0)
|
||||||
|
{
|
||||||
|
if (dealloc)
|
||||||
|
Z_Free(realpatch);
|
||||||
continue; // patch not located within texture's y bounds, ignore
|
continue; // patch not located within texture's y bounds, ignore
|
||||||
|
}
|
||||||
|
|
||||||
// patch is actually inside the texture!
|
// patch is actually inside the texture!
|
||||||
// now check if texture is partly off-screen and adjust accordingly
|
// now check if texture is partly off-screen and adjust accordingly
|
||||||
|
|
Loading…
Reference in a new issue