From: Wilfried Goesgens Date: Sat, 7 Jun 2014 14:57:50 +0000 (+0200) Subject: CPU Percentage: after realloc the pointer becomes invalid; need to work on new pointer. X-Git-Tag: collectd-5.5.0~294^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=911b17c0df15eb9448ba41e773fa645f6aaa603e;p=collectd.git CPU Percentage: after realloc the pointer becomes invalid; need to work on new pointer. fixes https://gist.github.com/toni-moreno/a2f80021535f87202de7 --- diff --git a/src/cpu.c b/src/cpu.c index 2e225fd1..79dc1507 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -241,10 +241,11 @@ static int cpu_states_grow (void) return -1; } - for (i = percents_cells; i < size; i++) + percents = tmp; + + for (i = percents_cells ; i < size; i++) memset(&percents[i], 0, sizeof(*percents)); - percents = tmp; percents_cells = size; return 0; } /* cpu_states_grow */