variorum
variorum copied to clipboard
clocks_features: prevent subsequent calls to perf_storage_temp()
The first call to perf_storage_temp()
will either allocate 2UL * nsockets
or 2UL * nthreads
memory (depending on whether or not the function parameter control_domains
is SOCKET
or CORE
) and store the pointer in the static local struct perf_data d
variable. Subsequent calls to the function, regardless of the value of control_domains
, will simply return the pointer to the static struct. No memory reallocation will occur. While no one should ever do that, there is nothing in the function preventing that from happening, either.
Resolve by adding an error message that trips on second and subsequent calls.