X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fiptables.c;h=20dce658b95e4edd1767a4b36e341e1308ea7759;hb=610204218564e01513607a0f077c33145f2b41f7;hp=05e3e24b92b9716612b13748d8027521c289bd54;hpb=6a1a62048b6d0d2ddf5c17295609d3ebf010f40b;p=collectd.git diff --git a/src/iptables.c b/src/iptables.c index 05e3e24b..20dce658 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -111,7 +111,8 @@ static int iptables_config (const char *key, const char *value) else return (1); - ip_chain_t temp, *final, **list; + ip_chain_t temp = { 0 }; + ip_chain_t *final, **list; char *table; int table_len; char *chain; @@ -121,8 +122,6 @@ static int iptables_config (const char *key, const char *value) char *fields[4]; int fields_num; - memset (&temp, 0, sizeof (temp)); - value_copy = strdup (value); if (value_copy == NULL) { @@ -204,7 +203,7 @@ static int iptables_config (const char *key, const char *value) table = NULL; chain = NULL; - list = (ip_chain_t **) realloc (chain_list, (chain_num + 1) * sizeof (ip_chain_t *)); + list = realloc (chain_list, (chain_num + 1) * sizeof (ip_chain_t *)); if (list == NULL) { char errbuf[1024]; @@ -215,7 +214,7 @@ static int iptables_config (const char *key, const char *value) } chain_list = list; - final = (ip_chain_t *) malloc( sizeof(temp) ); + final = malloc(sizeof (*final)); if (final == NULL) { char errbuf[1024];