diff --git a/include/QF/plugin/vid_render.h b/include/QF/plugin/vid_render.h index 1bcffe276..377c0e1a3 100644 --- a/include/QF/plugin/vid_render.h +++ b/include/QF/plugin/vid_render.h @@ -66,6 +66,7 @@ typedef struct vid_model_funcs_s { int alias_cache; void (*Mod_SpriteLoadFrames) (struct mod_sprite_ctx_s *sprite_ctx); + void (*Skin_Free) (struct skin_s *skin); struct skin_s *(*Skin_SetColormap) (struct skin_s *skin, int cmap); struct skin_s *(*Skin_SetSkin) (struct skin_s *skin, int cmap, const char *skinname); diff --git a/include/mod_internal.h b/include/mod_internal.h index af7581266..242e15666 100644 --- a/include/mod_internal.h +++ b/include/mod_internal.h @@ -104,6 +104,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer, void Mod_LoadSpriteModel (model_t *mod, void *buffer); void Skin_Init (void); +void Skin_Free (skin_t *skin); skin_t *Skin_SetColormap (skin_t *skin, int cmap); skin_t *Skin_SetSkin (skin_t *skin, int cmap, const char *skinname); void Skin_SetTranslation (int cmap, int top, int bottom); diff --git a/libs/models/skin.c b/libs/models/skin.c index 2cbe90839..ebc16d360 100644 --- a/libs/models/skin.c +++ b/libs/models/skin.c @@ -71,6 +71,14 @@ new_skin (void) return calloc (1, sizeof (skin_t)); } +VISIBLE void +Skin_Free (skin_t *skin) +{ + if (skin) { + free (skin); + } +} + VISIBLE void Skin_SetTranslation (int cmap, int top, int bottom) { diff --git a/libs/video/renderer/vid_render_gl.c b/libs/video/renderer/vid_render_gl.c index 9d99ca43d..7944e3ada 100644 --- a/libs/video/renderer/vid_render_gl.c +++ b/libs/video/renderer/vid_render_gl.c @@ -170,6 +170,7 @@ static vid_model_funcs_t model_funcs = { 1, gl_Mod_SpriteLoadFrames, + Skin_Free, Skin_SetColormap, Skin_SetSkin, gl_Skin_SetupSkin, diff --git a/libs/video/renderer/vid_render_glsl.c b/libs/video/renderer/vid_render_glsl.c index 132e1f062..9be89b23a 100644 --- a/libs/video/renderer/vid_render_glsl.c +++ b/libs/video/renderer/vid_render_glsl.c @@ -81,6 +81,7 @@ static vid_model_funcs_t model_funcs = { 0, glsl_Mod_SpriteLoadFrames, + Skin_Free, Skin_SetColormap, Skin_SetSkin, glsl_Skin_SetupSkin, diff --git a/libs/video/renderer/vid_render_sw.c b/libs/video/renderer/vid_render_sw.c index a7d69ada7..a4a532557 100644 --- a/libs/video/renderer/vid_render_sw.c +++ b/libs/video/renderer/vid_render_sw.c @@ -90,6 +90,7 @@ static vid_model_funcs_t model_funcs = { 1, sw_Mod_SpriteLoadFrames, + Skin_Free, Skin_SetColormap, Skin_SetSkin, sw_Skin_SetupSkin, diff --git a/libs/video/renderer/vid_render_vulkan.c b/libs/video/renderer/vid_render_vulkan.c index 901a55420..267d19424 100644 --- a/libs/video/renderer/vid_render_vulkan.c +++ b/libs/video/renderer/vid_render_vulkan.c @@ -654,6 +654,7 @@ static vid_model_funcs_t model_funcs = { 0, vulkan_Mod_SpriteLoadFrames, + Skin_Free, Skin_SetColormap, Skin_SetSkin, vulkan_Skin_SetupSkin, diff --git a/nq/source/cl_ents.c b/nq/source/cl_ents.c index cdfbe644d..10121f577 100644 --- a/nq/source/cl_ents.c +++ b/nq/source/cl_ents.c @@ -73,6 +73,7 @@ CL_ClearEnts (void) for (i = 0; i < MAX_EDICTS; i++) { if (cl_entities[i]) { + mod_funcs->Skin_Free (cl_entities[i]->renderer.skin); Scene_DestroyEntity (cl_world.scene, cl_entities[i]); cl_entities[i] = 0; }