Introduce clear_proc_devices() function in order to clear allocated for all_proc_devices memory.
Signed-off-by: Sergey Senozhatsky <sergey.senozhat...@gmail.com> --- diff --git a/process/device.cpp b/process/device.cpp index 4d3d2c5..2fe7571 100644 --- a/process/device.cpp +++ b/process/device.cpp @@ -88,3 +88,12 @@ void all_devices_to_all_power(void) for (i = 0; i < all_devices.size(); i++) add_device(all_devices[i]); } + +void clear_proc_devices(void) +{ + std::vector<class device_consumer *>::iterator it = all_proc_devices.begin(); + while (it != all_proc_devices.end()) { + delete *it; + it = all_proc_devices.erase(it); + } +} diff --git a/process/device.h b/process/device.h index b40f3d2..3392d3e 100644 --- a/process/device.h +++ b/process/device.h @@ -50,5 +50,6 @@ public: extern void all_devices_to_all_power(void); extern vector<class device_consumer *> all_proc_devices; +extern void clear_proc_devices(void); -#endif \ No newline at end of file +#endif _______________________________________________ Discuss mailing list Discuss@lesswatts.org http://lists.lesswatts.org/listinfo/discuss