conf: free refclock strings on exit
Free driver name and parameter of configured refclocks in helpers on exit.
This commit is contained in:
parent
f3aea33ad4
commit
c94e7c72e7
2 changed files with 10 additions and 4 deletions
10
conf.c
10
conf.c
|
@ -422,6 +422,10 @@ CNF_Finalise(void)
|
||||||
Free(((NTP_Source *)ARR_GetElement(ntp_sources, i))->params.name);
|
Free(((NTP_Source *)ARR_GetElement(ntp_sources, i))->params.name);
|
||||||
for (i = 0; i < ARR_GetSize(ntp_source_dirs); i++)
|
for (i = 0; i < ARR_GetSize(ntp_source_dirs); i++)
|
||||||
Free(*(char **)ARR_GetElement(ntp_source_dirs, i));
|
Free(*(char **)ARR_GetElement(ntp_source_dirs, i));
|
||||||
|
for (i = 0; i < ARR_GetSize(refclock_sources); i++) {
|
||||||
|
Free(((RefclockParameters *)ARR_GetElement(refclock_sources, i))->driver_name);
|
||||||
|
Free(((RefclockParameters *)ARR_GetElement(refclock_sources, i))->driver_parameter);
|
||||||
|
}
|
||||||
|
|
||||||
ARR_DestroyInstance(init_sources);
|
ARR_DestroyInstance(init_sources);
|
||||||
ARR_DestroyInstance(ntp_sources);
|
ARR_DestroyInstance(ntp_sources);
|
||||||
|
@ -1839,10 +1843,14 @@ CNF_AddSources(void)
|
||||||
void
|
void
|
||||||
CNF_AddRefclocks(void)
|
CNF_AddRefclocks(void)
|
||||||
{
|
{
|
||||||
|
RefclockParameters *refclock;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < ARR_GetSize(refclock_sources); i++) {
|
for (i = 0; i < ARR_GetSize(refclock_sources); i++) {
|
||||||
RCL_AddRefclock((RefclockParameters *)ARR_GetElement(refclock_sources, i));
|
refclock = ARR_GetElement(refclock_sources, i);
|
||||||
|
RCL_AddRefclock(refclock);
|
||||||
|
Free(refclock->driver_name);
|
||||||
|
Free(refclock->driver_parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
ARR_SetSize(refclock_sources, 0);
|
ARR_SetSize(refclock_sources, 0);
|
||||||
|
|
|
@ -181,7 +181,7 @@ RCL_AddRefclock(RefclockParameters *params)
|
||||||
LOG_FATAL("refclock tai option requires leapsectz");
|
LOG_FATAL("refclock tai option requires leapsectz");
|
||||||
|
|
||||||
inst->data = NULL;
|
inst->data = NULL;
|
||||||
inst->driver_parameter = params->driver_parameter;
|
inst->driver_parameter = Strdup(params->driver_parameter);
|
||||||
inst->driver_parameter_length = 0;
|
inst->driver_parameter_length = 0;
|
||||||
inst->driver_poll = params->driver_poll;
|
inst->driver_poll = params->driver_poll;
|
||||||
inst->poll = params->poll;
|
inst->poll = params->poll;
|
||||||
|
@ -261,8 +261,6 @@ RCL_AddRefclock(RefclockParameters *params)
|
||||||
params->driver_name, UTI_RefidToString(inst->ref_id),
|
params->driver_name, UTI_RefidToString(inst->ref_id),
|
||||||
inst->poll, inst->driver_poll, params->filter_length);
|
inst->poll, inst->driver_poll, params->filter_length);
|
||||||
|
|
||||||
Free(params->driver_name);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue