mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:35:06 -05:00
Fix errors detected by valgrind
I tried running chronyd in valgrind and the result was that there are four places where memory is not initialized. A patch fixing the errors is in the attachment.
This commit is contained in:
committed by
Richard P. Curnow
parent
bc0aaa9217
commit
8336f14680
@@ -721,8 +721,12 @@ SST_PredictOffset(SST_Stats inst, struct timeval *when)
|
||||
if (inst->n_samples < 3) {
|
||||
/* We don't have any useful statistics, and presumably the poll
|
||||
interval is minimal. We can't do any useful prediction other
|
||||
than use the latest sample */
|
||||
return inst->offsets[inst->n_samples - 1];
|
||||
than use the latest sample or zero if we don't have any samples */
|
||||
if (inst->n_samples > 0) {
|
||||
return inst->offsets[inst->n_samples - 1];
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
} else {
|
||||
UTI_DiffTimevalsToDouble(&elapsed, when, &inst->offset_time);
|
||||
return inst->estimated_offset + elapsed * inst->estimated_frequency;
|
||||
|
||||
Reference in New Issue
Block a user