int *firstsurfacefortexture;
int *numsurfacesfortexture;
if (!mod->sortedmodelsurfaces)
- mod->sortedmodelsurfaces = Mem_Alloc(tempmempool, mod->nummodelsurfaces * sizeof(*mod->sortedmodelsurfaces));
+ mod->sortedmodelsurfaces = Mem_Alloc(loadmodel->mempool, mod->nummodelsurfaces * sizeof(*mod->sortedmodelsurfaces));
firstsurfacefortexture = Mem_Alloc(tempmempool, mod->num_textures * sizeof(*firstsurfacefortexture));
numsurfacesfortexture = Mem_Alloc(tempmempool, mod->num_textures * sizeof(*numsurfacesfortexture));
memset(numsurfacesfortexture, 0, mod->num_textures * sizeof(*numsurfacesfortexture));