X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdns.c;h=17f879674d0eff3025d88b0035adfaa02bce627b;hb=a5377cf935630082f2eac2e5f4a538844cc06c8d;hp=fd75dc93a9437fb9bd0d7a580c1937e26f19b859;hpb=81a5fd5046c6a39f580a8fc1a3af837fd5f5aa5c;p=collectd.git diff --git a/src/dns.c b/src/dns.c index fd75dc93..17f87967 100644 --- a/src/dns.c +++ b/src/dns.c @@ -25,16 +25,15 @@ #define _BSD_SOURCE #include "collectd.h" + #include "common.h" #include "plugin.h" #include "configfile.h" #include "utils_dns.h" -#include #include #include -#include /* * Private data types @@ -95,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; @@ -213,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; @@ -240,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) {