free for real

This commit is contained in:
Denis 2024-03-31 22:39:50 +03:00
parent 823998d87f
commit d5c26f28d6

View file

@ -598,10 +598,7 @@ R_ReallocateMapBuffers (void)
if (!r_numallocatedlights || r_outoflights) if (!r_numallocatedlights || r_outoflights)
{ {
if (!blocklights) free(blocklights);
{
free(blocklights);
}
if (r_outoflights) if (r_outoflights)
{ {
@ -628,10 +625,7 @@ R_ReallocateMapBuffers (void)
if (!r_numallocatededges || r_outofedges) if (!r_numallocatededges || r_outofedges)
{ {
if (!r_edges) free(r_edges);
{
free(r_edges);
}
if (r_outofedges) if (r_outofedges)
{ {
@ -700,8 +694,9 @@ R_ReallocateMapBuffers (void)
r_outoftriangles = false; r_outoftriangles = false;
} }
if (r_numallocatedtriangles < vid.height) // one more for the terminator
r_numallocatedtriangles = vid.height; if (r_numallocatedtriangles < vid.height+1)
r_numallocatedtriangles = vid.height+1;
triangle_spans = malloc(r_numallocatedtriangles * sizeof(spanpackage_t)); triangle_spans = malloc(r_numallocatedtriangles * sizeof(spanpackage_t));
if (!triangle_spans) if (!triangle_spans)
@ -712,7 +707,7 @@ R_ReallocateMapBuffers (void)
} }
triangles_max = &triangle_spans[r_numallocatedtriangles]; triangles_max = &triangle_spans[r_numallocatedtriangles];
R_Printf(PRINT_ALL, "Allocated %d triangles.\n", r_numallocatedtriangles); R_Printf(PRINT_ALL, "Allocated %d triangle spans.\n", r_numallocatedtriangles);
} }
if (!r_numallocatededgebasespans || r_outedgebasespans) if (!r_numallocatededgebasespans || r_outedgebasespans)