From 5e6230c1597ba02a4fb815d2bd553e64028675f5 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Mon, 28 Jul 2014 15:12:42 +0200 Subject: [PATCH] zfs_arc: bugfix: increment array index also avoid recycling the previous iterator, for the sake of better code understanding. --- src/zfs_arc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) -- 2.30.2