diff --git a/tools/qfvis/source/base-vis.c b/tools/qfvis/source/base-vis.c index 6174ae9a5..6695b58e4 100644 --- a/tools/qfvis/source/base-vis.c +++ b/tools/qfvis/source/base-vis.c @@ -94,8 +94,6 @@ BasePortalVis (void) portal_t *tp, *portal; winding_t *winding; - if (portalsee) - set_delete (portalsee); portalsee = set_new_size (numportals * 2); for (i = 0, portal = portals; i < numportals * 2; i++, portal++) { portal->mightsee = set_new_size (portalclusters); @@ -133,4 +131,5 @@ BasePortalVis (void) SimpleFlood (portal, portal->cluster); portal->nummightsee = clustersee; } + set_delete (portalsee); } diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index 6654ef8e0..f5b5652e0 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -338,6 +338,7 @@ WatchThread (void *_thread) } } printf ("watch thread done\n"); + free (local_work); return NULL; } @@ -425,6 +426,8 @@ ClusterFlow (int clusternum) // expand to cluster->leaf PVS ClusterFlowExpand (visclusters, outbuffer); + set_delete (visclusters); + // compress the bit string if (options.verbosity > 0) printf ("cluster %4i : %4i visible\n", clusternum, numvis); @@ -482,6 +485,8 @@ CalcPortalVis (void) if (pthread_mutex_destroy (my_mutex) == -1) Sys_Error ("pthread_mutex_destroy failed"); + free (working); + free (my_mutex); } else { LeafThread (0); } @@ -909,5 +914,14 @@ main (int argc, char **argv) if (options.verbosity >= 0) printf ("%5.1f seconds elapsed\n", stop - start); + dstring_delete (portalfile); + dstring_delete (visdata); + dstring_delete (options.bspfile); + BSP_Free (bsp); + free (leafcluster); + free (uncompressed); + free (portals); + free (clusters); + return 0; }