Auto-Merge pull request #2948 from rubenk/turbostat-free-the-right-vars
authorcollectd bot <32910397+collectd-bot@users.noreply.github.com>
Thu, 11 Oct 2018 06:02:46 +0000 (08:02 +0200)
committerGitHub <noreply@github.com>
Thu, 11 Oct 2018 06:02:46 +0000 (08:02 +0200)
Automatically merged due to "Automerge" label

src/turbostat.c

index e4419b8..f388515 100644 (file)
@@ -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;
   }