turbostat plugin: free the right variable
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Tue, 29 May 2018 08:37:18 +0000 (10:37 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Wed, 10 Oct 2018 13:12:24 +0000 (15:12 +0200)
commit4f4db565a589411e13790f4aab30cb1b1af22530
tree1c6a4fcb474ff3b108cd569b18737d1cd8ef8dae
parent0684aea7453186e6f90ce4b6b8c5bcca68f0d1b9
turbostat plugin: free the right variable

scan-build: Using '/usr/bin/clang-6.0' for static analysis
make  all-am
make[1]: Entering directory '/home/ruben/src/collectd'
  CC       src/turbostat.lo
src/turbostat.c:1292:5: warning: Argument to free() is the address of the global variable 'thread_delta', which is not memory allocated by malloc()
    sfree(threads);
    ^~~~~~~~~~~~~~
./src/daemon/common.h:41:5: note: expanded from macro 'sfree'
    free(ptr);                                                                 \
    ^~~~~~~~~
src/turbostat.c:1299:5: warning: Argument to free() is the address of the global variable 'core_delta', which is not memory allocated by malloc()
    sfree(cores);
    ^~~~~~~~~~~~
./src/daemon/common.h:41:5: note: expanded from macro 'sfree'
    free(ptr);                                                                 \
    ^~~~~~~~~
2 warnings generated.
  CCLD     turbostat.la

(cherry picked from commit 74eda959ddf653b7d20779d84f0a140e85376726)
src/turbostat.c