I believe you need to call pclose() on the descriptors returned from popen() in your CPUread() function.
See the popen() documentation here:
I’m not sure this directly is the cause of your problem, but it is definitely a resource leak.
0
solved Memory leak with out malloc [closed]