X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdns.c;h=5930dc5033ad85e74ae0f01a5d592a0086f71ad0;hb=aa3811995bfae69f0d1a0f897acfa4a9a4c0138a;hp=3421c475d7e6fc49c2419332dbcd8e5d3dd09f06;hpb=791e99923dbbf045b11fbd7b0ea8df647e29593e;p=collectd.git diff --git a/src/dns.c b/src/dns.c index 3421c475..5930dc50 100644 --- a/src/dns.c +++ b/src/dns.c @@ -30,7 +30,6 @@ #include "configfile.h" #include "utils_dns.h" -#include #include #include @@ -94,11 +93,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 +210,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 +237,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) {