X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetlink.c;h=5c3a9f007beb656aeefcc2a81152243671243d1e;hb=38909dcf1dcb596c5f525c6bb25cf89c046013b5;hp=aa9760f9328b78eb87e14f70501bc1622a57f12d;hpb=d9db39b8e8b5e9a34d955d057574f6ddd00759e6;p=collectd.git diff --git a/src/netlink.c b/src/netlink.c index aa9760f9..5c3a9f00 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -30,7 +30,6 @@ #include "common.h" #include -#include #include #include @@ -110,12 +109,10 @@ static int add_ignorelist (const char *dev, const char *type, { ir_ignorelist_t *entry; - entry = (ir_ignorelist_t *) malloc (sizeof (ir_ignorelist_t)); + entry = calloc (1, sizeof (*entry)); if (entry == NULL) return (-1); - memset (entry, '\0', sizeof (ir_ignorelist_t)); - if (strcasecmp (dev, "All") != 0) { entry->device = strdup (dev); @@ -247,7 +244,7 @@ static int update_iflist (struct ifinfomsg *msg, const char *dev) { char **temp; - temp = (char **) realloc (iflist, (msg->ifi_index + 1) * sizeof (char *)); + temp = realloc (iflist, (msg->ifi_index + 1) * sizeof (char *)); if (temp == NULL) { ERROR ("netlink plugin: update_iflist: realloc failed."); @@ -471,7 +468,7 @@ static int qos_filter_cb (const struct nlmsghdr *nlh, void *args) const char *kind = NULL; /* char *type_instance; */ - char *tc_type; + const char *tc_type; char tc_inst[DATA_MAX_NAME_LEN]; _Bool stats_submitted = 0;