diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-03-16 07:50:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-03-16 07:50:20 +0000 |
commit | b26be28df9fd4db2106cc2a557966c9d2a7345d9 (patch) | |
tree | 437e6106c0aa2e73f2dd68d0551545ae503f60d7 /collectors/proc.plugin/proc_stat.c | |
parent | Adding upstream version 1.12.2. (diff) | |
download | netdata-b26be28df9fd4db2106cc2a557966c9d2a7345d9.tar.xz netdata-b26be28df9fd4db2106cc2a557966c9d2a7345d9.zip |
Adding upstream version 1.13.0.upstream/1.13.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/proc.plugin/proc_stat.c')
-rw-r--r-- | collectors/proc.plugin/proc_stat.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/collectors/proc.plugin/proc_stat.c b/collectors/proc.plugin/proc_stat.c index ad893456b..f98b09561 100644 --- a/collectors/proc.plugin/proc_stat.c +++ b/collectors/proc.plugin/proc_stat.c @@ -404,8 +404,8 @@ static int read_cpuidle_states(char *cpuidle_name_filename , char *cpuidle_time_ } snprintfz(next_state_filename, FILENAME_MAX, cpuidle_name_filename, core, cc->cpuidle_state_len); - cc->cpuidle_state = callocz(cc->cpuidle_state_len, sizeof(struct cpuidle_state)); - memset(cc->cpuidle_state, 0, sizeof(struct cpuidle_state) * cc->cpuidle_state_len); + if(likely(cc->cpuidle_state_len)) + cc->cpuidle_state = callocz(cc->cpuidle_state_len, sizeof(struct cpuidle_state)); for(state = 0; state < cc->cpuidle_state_len; state++) { char name_buf[50 + 1]; |