Don't use uninitialized values
This fixes a bunch or valgrind errors.
This commit is contained in:
parent
d06f02be1c
commit
183d56fd40
4 changed files with 10 additions and 2 deletions
2
client.c
2
client.c
|
@ -1158,6 +1158,8 @@ submit_request(CMD_Request *request, CMD_Reply *reply, int *reply_auth_ok)
|
|||
request->utoken = htonl(SPECIAL_UTOKEN);
|
||||
}
|
||||
generate_auth(request);
|
||||
} else {
|
||||
memset(request->auth, 0, sizeof (request->auth));
|
||||
}
|
||||
|
||||
command_length = PKL_CommandLength(request);
|
||||
|
|
|
@ -323,6 +323,8 @@ create_instance(NTP_Remote_Address *remote_addr, NTP_Mode mode, SourceParameters
|
|||
|
||||
result->local_rx.tv_sec = 0;
|
||||
result->local_rx.tv_usec = 0;
|
||||
result->local_tx.tv_sec = 0;
|
||||
result->local_tx.tv_usec = 0;
|
||||
|
||||
return result;
|
||||
|
||||
|
|
5
ntp_io.c
5
ntp_io.c
|
@ -307,13 +307,14 @@ send_packet(void *packet, int packetlen, NTP_Remote_Address *remote_addr)
|
|||
struct in_pktinfo *ipi;
|
||||
|
||||
cmsg = CMSG_FIRSTHDR(&msg);
|
||||
memset(cmsg, 0, CMSG_SPACE(sizeof(struct in_pktinfo)));
|
||||
cmsglen += CMSG_SPACE(sizeof(struct in_pktinfo));
|
||||
|
||||
cmsg->cmsg_level = IPPROTO_IP;
|
||||
cmsg->cmsg_type = IP_PKTINFO;
|
||||
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
|
||||
cmsglen += CMSG_SPACE(sizeof(struct in_pktinfo));
|
||||
|
||||
ipi = (struct in_pktinfo *) CMSG_DATA(cmsg);
|
||||
memset(ipi, 0, sizeof(struct in_pktinfo));
|
||||
ipi->ipi_spec_dst.s_addr = htonl(remote_addr->local_ip_addr);
|
||||
#if 0
|
||||
LOG(LOGS_INFO, LOGF_NtpIO, "sending to %s:%d from %s",
|
||||
|
|
|
@ -198,6 +198,8 @@ SST_CreateInstance(unsigned long refid)
|
|||
inst->skew_dirn = SST_Skew_Nochange;
|
||||
inst->estimated_offset = 0.0;
|
||||
inst->estimated_offset_sd = 86400.0; /* Assume it's at least within a day! */
|
||||
inst->offset_time.tv_sec = 0;
|
||||
inst->offset_time.tv_usec = 0;
|
||||
inst->variance = 16.0;
|
||||
inst->nruns = 0;
|
||||
return inst;
|
||||
|
@ -874,6 +876,7 @@ SST_DoSourceReport(SST_Stats inst, RPT_SourceReport *report, struct timeval *now
|
|||
report->resid_skew = 0;
|
||||
}
|
||||
} else {
|
||||
report->latest_meas_ago = 86400 * 365 * 10;
|
||||
report->orig_latest_meas = 0;
|
||||
report->latest_meas = 0;
|
||||
report->latest_meas_err = 0;
|
||||
|
|
Loading…
Reference in a new issue