From: Marc Fournier Date: Mon, 28 Jul 2014 13:12:42 +0000 (+0200) Subject: zfs_arc: bugfix: increment array index X-Git-Tag: collectd-5.5.0~218^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5e6230c1597ba02a4fb815d2bd553e64028675f5;p=collectd.git zfs_arc: bugfix: increment array index also avoid recycling the previous iterator, for the sake of better code understanding. --- diff --git a/src/zfs_arc.c b/src/zfs_arc.c index 168d566b..b784ee3a 100644 --- a/src/zfs_arc.c +++ b/src/zfs_arc.c @@ -208,7 +208,7 @@ static int za_read (void) { llentry_t *e; llvalues = malloc(sizeof(long long int) * i); - i = 0; + int j = 0; pnl = file_contents; while (pnl != NULL) @@ -220,9 +220,9 @@ static int za_read (void) numfields = strsplit (pnl, fields, 4); if (numfields == 3) { - llvalues[i] = atoll (fields[2]); + llvalues[j] = atoll (fields[2]); - e = llentry_create (fields[0], &llvalues[i]); + e = llentry_create (fields[0], &llvalues[j]); if (e == NULL) { ERROR ("zfs_arc plugin: `llentry_create' failed."); @@ -231,6 +231,7 @@ static int za_read (void) { llist_append (ksp, e); } + j++; } pnl = pnnl; if (pnl != NULL)