mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
mdsprite.c: in md3free(), also free s->geometry for each surface. DONT_BUILD.
This prevents a enormous leak being reported by LeakSanitizer. Not that it matters much, since we most frequently free models only at exit. (Sometimes one may be freed earlier though -- if there was an error loading it, AFAICS.) git-svn-id: https://svn.eduke32.com/eduke32@4952 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a0a4006d85
commit
910716fa11
1 changed files with 7 additions and 8 deletions
|
@ -1416,7 +1416,7 @@ static md3model_t *md3load(int32_t fil)
|
||||||
|
|
||||||
klseek(fil,m->head.ofssurfs,SEEK_SET); i = m->head.numsurfs*sizeof(md3surf_t);
|
klseek(fil,m->head.ofssurfs,SEEK_SET); i = m->head.numsurfs*sizeof(md3surf_t);
|
||||||
m->head.surfs = (md3surf_t *)Xmalloc(i);
|
m->head.surfs = (md3surf_t *)Xmalloc(i);
|
||||||
m->head.surfs[0].geometry = NULL; // for deferred polymer model postprocessing (else: crashes)
|
m->head.surfs[0].geometry = NULL; // for POLYMER_MD_PROCESS_CHECK (else: crashes)
|
||||||
|
|
||||||
#if B_BIG_ENDIAN != 0
|
#if B_BIG_ENDIAN != 0
|
||||||
{
|
{
|
||||||
|
@ -1695,9 +1695,9 @@ int md3postload_polymer(md3model_t *m)
|
||||||
{
|
{
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
int framei, surfi, verti, trii, i;
|
int framei, surfi, verti, trii, i;
|
||||||
md3surf_t *s;
|
|
||||||
float vec1[5], vec2[5], mat[9], r;
|
float vec1[5], vec2[5], mat[9], r;
|
||||||
|
|
||||||
|
// POLYMER_MD_PROCESS_CHECK
|
||||||
if (m->head.surfs[0].geometry)
|
if (m->head.surfs[0].geometry)
|
||||||
return -1; // already postprocessed
|
return -1; // already postprocessed
|
||||||
|
|
||||||
|
@ -1711,7 +1711,7 @@ int md3postload_polymer(md3model_t *m)
|
||||||
{
|
{
|
||||||
handleevents();
|
handleevents();
|
||||||
|
|
||||||
s = &m->head.surfs[surfi];
|
md3surf_t *const s = &m->head.surfs[surfi];
|
||||||
#ifdef DEBUG_MODEL_MEM
|
#ifdef DEBUG_MODEL_MEM
|
||||||
i = (m->head.numframes * s->numverts * sizeof(float) * 15);
|
i = (m->head.numframes * s->numverts * sizeof(float) * 15);
|
||||||
if (i > 1<<20)
|
if (i > 1<<20)
|
||||||
|
@ -2392,8 +2392,6 @@ static void md3free(md3model_t *m)
|
||||||
{
|
{
|
||||||
mdanim_t *anim, *nanim = NULL;
|
mdanim_t *anim, *nanim = NULL;
|
||||||
mdskinmap_t *sk, *nsk = NULL;
|
mdskinmap_t *sk, *nsk = NULL;
|
||||||
md3surf_t *s;
|
|
||||||
int32_t surfi;
|
|
||||||
|
|
||||||
if (!m) return;
|
if (!m) return;
|
||||||
|
|
||||||
|
@ -2411,10 +2409,11 @@ static void md3free(md3model_t *m)
|
||||||
|
|
||||||
if (m->head.surfs)
|
if (m->head.surfs)
|
||||||
{
|
{
|
||||||
for (surfi=m->head.numsurfs-1; surfi>=0; surfi--)
|
for (int surfi=m->head.numsurfs-1; surfi>=0; surfi--)
|
||||||
{
|
{
|
||||||
s = &m->head.surfs[surfi];
|
md3surf_t *s = &m->head.surfs[surfi];
|
||||||
if (s->tris) Bfree(s->tris);
|
Bfree(s->tris);
|
||||||
|
Bfree(s->geometry);
|
||||||
}
|
}
|
||||||
Bfree(m->head.surfs);
|
Bfree(m->head.surfs);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue