mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 00:30:57 +00:00
fix a few memory access bugs
This commit is contained in:
parent
00294f7ae0
commit
dd5cac488c
3 changed files with 17 additions and 11 deletions
|
@ -453,7 +453,7 @@ void
|
|||
LightFace (int surfnum)
|
||||
{
|
||||
int ofs;
|
||||
byte *out;
|
||||
byte *out, *outdata;
|
||||
dface_t *f;
|
||||
int lightmapwidth, lightmapsize, size, c, i, j, s, t, w, h;
|
||||
lightinfo_t l;
|
||||
|
@ -516,7 +516,7 @@ LightFace (int surfnum)
|
|||
lightmapsize = size * l.numlightstyles;
|
||||
|
||||
LOCK;
|
||||
out = malloc (lightmapsize);
|
||||
outdata = out = malloc (lightmapsize);
|
||||
UNLOCK;
|
||||
ofs = GetFileSpace (lightmapsize);
|
||||
f->lightofs = ofs;
|
||||
|
@ -550,7 +550,7 @@ LightFace (int surfnum)
|
|||
}
|
||||
}
|
||||
LOCK;
|
||||
memcpy (lightdata->str + ofs, out, lightmapsize);
|
||||
free (out);
|
||||
memcpy (lightdata->str + ofs, outdata, lightmapsize);
|
||||
free (outdata);
|
||||
UNLOCK;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ GetFileSpace (int size)
|
|||
int ofs;
|
||||
|
||||
LOCK;
|
||||
lightdata->size = (lightdata->size + 3) & 3;
|
||||
lightdata->size = (lightdata->size + 3) & ~3;
|
||||
ofs = lightdata->size;
|
||||
lightdata->size += size;
|
||||
dstring_adjust (lightdata);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue