X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdns.c;h=17f879674d0eff3025d88b0035adfaa02bce627b;hb=a5377cf935630082f2eac2e5f4a538844cc06c8d;hp=3421c475d7e6fc49c2419332dbcd8e5d3dd09f06;hpb=5e9ca5dcb56df80e9a4142a536425d1931a3c3f6;p=collectd.git diff --git a/src/dns.c b/src/dns.c index 3421c475..17f87967 100644 --- a/src/dns.c +++ b/src/dns.c @@ -25,12 +25,12 @@ #define _BSD_SOURCE #include "collectd.h" + #include "common.h" #include "plugin.h" #include "configfile.h" #include "utils_dns.h" -#include #include #include @@ -94,11 +94,10 @@ static counter_list_t *counter_list_create (counter_list_t **list, { counter_list_t *entry; - entry = (counter_list_t *) malloc (sizeof (counter_list_t)); + entry = calloc (1, sizeof (*entry)); if (entry == NULL) return (NULL); - memset (entry, 0, sizeof (counter_list_t)); entry->key = key; entry->value = value; @@ -212,7 +211,7 @@ static int dns_run_pcap_loop (void) { pcap_t *pcap_obj; char pcap_error[PCAP_ERRBUF_SIZE]; - struct bpf_program fp; + struct bpf_program fp = { 0 }; int status; @@ -239,7 +238,6 @@ static int dns_run_pcap_loop (void) return (PCAP_ERROR); } - memset (&fp, 0, sizeof (fp)); status = pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0); if (status < 0) {