From c0e49c708814ec783726fe92202371847703c5ed Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 12 Nov 2018 17:27:58 +0100 Subject: [PATCH] sysoff: Initialize data for ioctl(PTP_SYS_OFFSET). This fixes valgrind errors. Signed-off-by: Miroslav Lichvar --- sysoff.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sysoff.c b/sysoff.c index f7b6240..407a01c 100644 --- a/sysoff.c +++ b/sysoff.c @@ -18,6 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include +#include #include #include @@ -76,6 +77,7 @@ int sysoff_measure(int fd, int n_samples, int64_t *result, uint64_t *ts, int64_t *delay) { struct ptp_sys_offset pso; + memset(&pso, 0, sizeof(pso)); pso.n_samples = n_samples; if (ioctl(fd, PTP_SYS_OFFSET, &pso)) { perror("ioctl PTP_SYS_OFFSET");