turbostat plugin: show error details
[collectd.git] / src / turbostat.c
index 2bc7e3f..b5d3520 100644 (file)
@@ -1289,15 +1289,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;
   }
 
@@ -1429,7 +1429,7 @@ static int turbostat_read(void) {
   /* Saving the scheduling affinity, as it will be modified by get_counters */
   if (sched_getaffinity(0, cpu_saved_affinity_setsize,
                         cpu_saved_affinity_set) != 0) {
-    ERROR("turbostat plugin: Unable to save the CPU affinity");
+    ERROR("turbostat plugin: Unable to save the CPU affinity: %s", STRERRNO);
     return -1;
   }