From d5c26f28d67f474eaca5ff81239a1619d837983f Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 31 Mar 2024 22:39:50 +0300 Subject: [PATCH] free for real --- src/client/refresh/soft/sw_main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 641e1cc9..ff51e55a 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -598,10 +598,7 @@ R_ReallocateMapBuffers (void) if (!r_numallocatedlights || r_outoflights) { - if (!blocklights) - { - free(blocklights); - } + free(blocklights); if (r_outoflights) { @@ -628,10 +625,7 @@ R_ReallocateMapBuffers (void) if (!r_numallocatededges || r_outofedges) { - if (!r_edges) - { - free(r_edges); - } + free(r_edges); if (r_outofedges) { @@ -700,8 +694,9 @@ R_ReallocateMapBuffers (void) r_outoftriangles = false; } - if (r_numallocatedtriangles < vid.height) - r_numallocatedtriangles = vid.height; + // one more for the terminator + if (r_numallocatedtriangles < vid.height+1) + r_numallocatedtriangles = vid.height+1; triangle_spans = malloc(r_numallocatedtriangles * sizeof(spanpackage_t)); if (!triangle_spans) @@ -712,7 +707,7 @@ R_ReallocateMapBuffers (void) } 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)