mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
Fix crash when reloading history with zero samples
This commit is contained in:
@@ -172,6 +172,7 @@ SST_CreateInstance(unsigned long refid, IPAddr *addr)
|
||||
inst->n_samples = 0;
|
||||
inst->runs_samples = 0;
|
||||
inst->last_sample = 0;
|
||||
inst->best_single_sample = 0;
|
||||
inst->estimated_frequency = 0;
|
||||
inst->skew = 2000.0e-6;
|
||||
inst->skew_dirn = SST_Skew_Nochange;
|
||||
@@ -293,6 +294,9 @@ find_best_sample_index(SST_Stats inst, double *times_back)
|
||||
double elapsed;
|
||||
int i, j, best_index;
|
||||
|
||||
if (!inst->n_samples)
|
||||
return;
|
||||
|
||||
best_index = -1;
|
||||
best_root_distance = DBL_MAX;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user