Free allocated memory on exit

This should reduce the number of possible memory leaks reported by
valgrind. The remaining reported leaks are sched tqe allocation, async
DNS instance allocation, cmdmon response/timestamp cell allocation, and
clientlog subnet allocation.
This commit is contained in:
Miroslav Lichvar
2014-09-23 13:35:38 +02:00
parent d466390233
commit f6ed7844e1
13 changed files with 116 additions and 9 deletions

View File

@@ -165,6 +165,7 @@ source_to_string(SRC_Instance inst);
void SRC_Initialise(void) {
sources = NULL;
sort_list = NULL;
sel_sources = NULL;
n_sources = 0;
max_n_sources = 0;
selected_source_index = INVALID_SOURCE;
@@ -183,6 +184,11 @@ void SRC_Finalise(void)
{
LCL_RemoveParameterChangeHandler(slew_sources, NULL);
LCL_RemoveDispersionNotifyHandler(add_dispersion, NULL);
Free(sources);
Free(sort_list);
Free(sel_sources);
initialised = 0;
}