From: Ruben Kerkhof Date: Fri, 10 Jun 2016 07:48:23 +0000 (+0200) Subject: Merge branch 'collectd-5.5' X-Git-Tag: collectd-5.6.0~226 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=38909dcf1dcb596c5f525c6bb25cf89c046013b5;hp=-c Merge branch 'collectd-5.5' --- 38909dcf1dcb596c5f525c6bb25cf89c046013b5 diff --combined src/ethstat.c index 8971f4df,a30a5d15..e10021c5 --- a/src/ethstat.c +++ b/src/ethstat.c @@@ -104,13 -104,14 +104,13 @@@ static int ethstat_add_map (const oconf return (ENOMEM); } - map = malloc (sizeof (*map)); + map = calloc (1, sizeof (*map)); if (map == NULL) { sfree (key); - ERROR ("ethstat plugin: malloc(3) failed."); + ERROR ("ethstat plugin: calloc failed."); return (ENOMEM); } - memset (map, 0, sizeof (*map)); sstrncpy (map->type, ci->values[1].value.string, sizeof (map->type)); if (ci->values_num == 3) @@@ -272,7 -273,7 +272,7 @@@ static int ethstat_read_interface (cha close (fd); sfree (strings); sfree (stats); - ERROR("ethstat plugin: malloc(3) failed."); + ERROR("ethstat plugin: malloc failed."); return (-1); } @@@ -311,9 -312,13 +311,13 @@@ for (i = 0; i < n_stats; i++) { - const char *stat_name; + char *stat_name; stat_name = (void *) &strings->data[i * ETH_GSTRING_LEN]; + /* Remove leading spaces in key name */ + while (isspace ((int) *stat_name)) + stat_name++; + DEBUG("ethstat plugin: device = \"%s\": %s = %"PRIu64, device, stat_name, (uint64_t) stats->data[i]); ethstat_submit_value (device,