vk: fix freeing NULL bmodel memory

This commit is contained in:
Ivan Avdeev 2023-04-28 13:29:02 -07:00
parent e1d250e8da
commit b93ef2e52c
1 changed files with 6 additions and 3 deletions

View File

@ -805,9 +805,12 @@ void VK_BrushModelDestroy( model_t *mod ) {
return;
VK_RenderModelDestroy(&bmodel->render_model);
Mem_Free(bmodel->animated_indexes);
Mem_Free(bmodel->surface_to_geometry_index);
Mem_Free(bmodel->render_model.geometries);
if (bmodel->animated_indexes)
Mem_Free(bmodel->animated_indexes);
if (bmodel->surface_to_geometry_index)
Mem_Free(bmodel->surface_to_geometry_index);
if (bmodel->render_model.geometries)
Mem_Free(bmodel->render_model.geometries);
Mem_Free(bmodel);
mod->cache.data = NULL;
}