mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-01 05:30:58 +00:00
LoadPCX() supports palette=NULL to avoid malloc()
when called from R_FindImage() the palette wasn't used anyway. R_FindImage() now passes NULL. (LoadPCX() is still called with non-NULL palette from Draw_GetPalette())
This commit is contained in:
parent
9970dc43ad
commit
c098ee2ce3
2 changed files with 3 additions and 10 deletions
|
@ -46,7 +46,6 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height)
|
|||
}
|
||||
|
||||
*pic = NULL;
|
||||
*palette = NULL;
|
||||
|
||||
/* load the file */
|
||||
len = ri.FS_LoadFile(filename, (void **)&raw);
|
||||
|
|
|
@ -1021,7 +1021,7 @@ R_FindImage(char *name, imagetype_t type)
|
|||
{
|
||||
image_t *image;
|
||||
int i, len;
|
||||
byte *pic, *palette;
|
||||
byte *pic;
|
||||
int width, height;
|
||||
char *ptr;
|
||||
char namewe[256];
|
||||
|
@ -1069,7 +1069,6 @@ R_FindImage(char *name, imagetype_t type)
|
|||
|
||||
/* load the pic from disk */
|
||||
pic = NULL;
|
||||
palette = NULL;
|
||||
|
||||
if (strcmp(ext, "pcx") == 0)
|
||||
{
|
||||
|
@ -1094,7 +1093,7 @@ R_FindImage(char *name, imagetype_t type)
|
|||
else
|
||||
{
|
||||
/* PCX if no TGA/PNG/JPEG available (exists always) */
|
||||
LoadPCX(name, &pic, &palette, &width, &height);
|
||||
LoadPCX(name, &pic, NULL, &width, &height);
|
||||
|
||||
if (!pic)
|
||||
{
|
||||
|
@ -1108,7 +1107,7 @@ R_FindImage(char *name, imagetype_t type)
|
|||
}
|
||||
else /* gl_retexture is not set */
|
||||
{
|
||||
LoadPCX(name, &pic, &palette, &width, &height);
|
||||
LoadPCX(name, &pic, NULL, &width, &height);
|
||||
|
||||
if (!pic)
|
||||
{
|
||||
|
@ -1199,11 +1198,6 @@ R_FindImage(char *name, imagetype_t type)
|
|||
free(pic);
|
||||
}
|
||||
|
||||
if (palette)
|
||||
{
|
||||
free(palette);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue