Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
d0b420c7
Commit
d0b420c7
authored
9 months ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Prevent a memory leak
parent
16560653
No related branches found
No related tags found
1 merge request
!2471
Use palette index 255 for transparency
Pipeline
#4311
passed
9 months ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hardware/hw_cache.c
+8
-9
8 additions, 9 deletions
src/hardware/hw_cache.c
with
8 additions
and
9 deletions
src/hardware/hw_cache.c
+
8
−
9
View file @
d0b420c7
...
...
@@ -675,25 +675,24 @@ void HWR_InitMapTextures(void)
gl_maptexturesloaded
=
false
;
}
static
void
DeleteTextureMipmap
(
GLMipmap_t
*
grMipmap
)
static
void
DeleteTextureMipmap
(
GLMipmap_t
*
grMipmap
,
boolean
delete_mipmap
)
{
HWD
.
pfnDeleteTexture
(
grMipmap
);
// Chroma-keyed textures do not own their texture data, so do not free it
if
(
!
(
grMipmap
->
flags
&
TF_CHROMAKEYED
))
if
(
delete_mipmap
)
Z_Free
(
grMipmap
->
data
);
}
static
void
FreeMapTexture
(
GLMapTexture_t
*
tex
)
static
void
FreeMapTexture
(
GLMapTexture_t
*
tex
,
boolean
delete_chromakeys
)
{
if
(
tex
->
mipmap
.
nextcolormap
)
{
DeleteTextureMipmap
(
tex
->
mipmap
.
nextcolormap
);
DeleteTextureMipmap
(
tex
->
mipmap
.
nextcolormap
,
delete_chromakeys
);
free
(
tex
->
mipmap
.
nextcolormap
);
tex
->
mipmap
.
nextcolormap
=
NULL
;
}
DeleteTextureMipmap
(
&
tex
->
mipmap
);
DeleteTextureMipmap
(
&
tex
->
mipmap
,
true
);
}
void
HWR_FreeMapTextures
(
void
)
...
...
@@ -702,8 +701,8 @@ void HWR_FreeMapTextures(void)
for
(
i
=
0
;
i
<
gl_numtextures
;
i
++
)
{
FreeMapTexture
(
&
gl_textures
[
i
]);
FreeMapTexture
(
&
gl_flats
[
i
]);
FreeMapTexture
(
&
gl_textures
[
i
]
,
true
);
FreeMapTexture
(
&
gl_flats
[
i
]
,
false
);
}
// now the heap don't have any 'user' pointing to our
...
...
@@ -777,7 +776,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean chromakeyed)
originalMipmap
->
nextcolormap
=
newMipmap
;
}
//
U
pload and bind the variant texture instead of the original one
//
Generate, u
pload and bind the variant texture instead of the original one
grMipmap
=
originalMipmap
->
nextcolormap
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment