mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
sourcestats: reset instance before loading dump file
Don't rely on the caller to reset the instance and always reset it before loading data to make sure it can't get to an unexpected state.
This commit is contained in:
@@ -884,7 +884,7 @@ SST_LoadFromFile(SST_Stats inst, FILE *in)
|
|||||||
char line[1024];
|
char line[1024];
|
||||||
double weight;
|
double weight;
|
||||||
|
|
||||||
assert(!inst->n_samples);
|
SST_ResetInstance(inst);
|
||||||
|
|
||||||
if (fgets(line, sizeof(line), in) &&
|
if (fgets(line, sizeof(line), in) &&
|
||||||
sscanf(line, "%d", &inst->n_samples) == 1 &&
|
sscanf(line, "%d", &inst->n_samples) == 1 &&
|
||||||
@@ -933,7 +933,6 @@ SST_LoadFromFile(SST_Stats inst, FILE *in)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
inst->last_sample = inst->n_samples - 1;
|
inst->last_sample = inst->n_samples - 1;
|
||||||
inst->runs_samples = 0;
|
|
||||||
|
|
||||||
find_min_delay_sample(inst);
|
find_min_delay_sample(inst);
|
||||||
SST_DoNewRegression(inst);
|
SST_DoNewRegression(inst);
|
||||||
|
|||||||
Reference in New Issue
Block a user