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:
Yamagi 2021-11-01 18:42:40 +01:00
parent b16b1b13d0
commit 8bb845b037

View file

@ -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];