Plug a bunch of memory leaks.

Not that they really matter, but it makes reading valgrind's output a
little easier.
This commit is contained in:
Bill Currie 2013-03-07 13:42:19 +09:00
parent 9b4beaf3f8
commit 81e4d3072c
2 changed files with 15 additions and 2 deletions

View file

@ -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);
}

View file

@ -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;
}