From d46540610626832b7762f1dbda6fe6d73cae7321 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Fri, 30 Mar 2018 10:29:30 -0700 Subject: [PATCH] pmc: Initialize variable on the stack. Valgrind is complaining that the pmc program is using uninitialized data. Actually the data are partially initialized, but it can't hurt to zero the entire data structure. Doing so silences the valgrind warning, and after all it is good practice. Signed-off-by: Richard Cochran --- pmc_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pmc_common.c b/pmc_common.c index 22aaeea..9d21210 100644 --- a/pmc_common.c +++ b/pmc_common.c @@ -66,8 +66,10 @@ struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type, UInteger8 domain_number, UInteger8 transport_specific, int zero_datalen) { - struct pmc *pmc; struct interface iface; + struct pmc *pmc; + + memset(&iface, 0, sizeof(iface)); pmc = calloc(1, sizeof *pmc); if (!pmc)