mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 12:41:21 +00:00
Fix potential memory leak in R_Upload8() in GL1.
This is a corner case, next to unlikely that anyone would have ever hit it. That's why my tests with asan didn't find the leak. The if case are paletted textures which must be enabled by setting `gl1_palettedtexture` to 1 and requires an GPU with support for `GL_EXT_paletted_texture`. Nvidia dropped support for that in 2005. Additionally a sky texture must be uploaded.
This commit is contained in:
parent
b16b1b13d0
commit
8bb845b037
1 changed files with 2 additions and 1 deletions
|
@ -786,7 +786,6 @@ qboolean
|
|||
R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky)
|
||||
{
|
||||
int s = width * height;
|
||||
unsigned *trans = malloc(s * sizeof(unsigned));
|
||||
|
||||
if (gl_config.palettedtexture && is_sky)
|
||||
{
|
||||
|
@ -801,6 +800,8 @@ R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky)
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned *trans = malloc(s * sizeof(unsigned));
|
||||
|
||||
for (int i = 0; i < s; i++)
|
||||
{
|
||||
int p = data[i];
|
||||
|
|
Loading…
Reference in a new issue