X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fturbostat.c;h=f388515820d15137894813b3b7b08e0fb791414e;hp=e4419b85689ea5003d06b799ec37982abcecfa88;hb=7111bb6df7628edce3a8e538b386fbe27633a191;hpb=7c2336dde35a7b42853b6ca167d4164619e52333 diff --git a/src/turbostat.c b/src/turbostat.c index e4419b85..f3885158 100644 --- a/src/turbostat.c +++ b/src/turbostat.c @@ -586,7 +586,8 @@ static int submit_counters(struct thread_data *t, struct core_data *c, /* If not using logical core numbering, set core id */ if (!config_lcn) { if (topology.num_packages > 1) - snprintf(name, sizeof(name), "pkg%02d-core%02d", p->package_id, c->core_id); + snprintf(name, sizeof(name), "pkg%02d-core%02d", p->package_id, + c->core_id); else snprintf(name, sizeof(name), "core%02d", c->core_id); } @@ -1287,15 +1288,15 @@ static int allocate_counters(struct thread_data **threads, *cores = calloc(total_cores, sizeof(struct core_data)); if (*cores == NULL) { ERROR("turbostat plugin: calloc failed"); - sfree(threads); + sfree(*threads); return -1; } *packages = calloc(topology.num_packages, sizeof(struct pkg_data)); if (*packages == NULL) { ERROR("turbostat plugin: calloc failed"); - sfree(cores); - sfree(threads); + sfree(*cores); + sfree(*threads); return -1; }