@cryptotaxi247 / netdata-1 / commits / e35211cdf

cgroups: properly remove not available cgroups from memory again

Costa Tsaousis committed Apr 30, 2016 at 02:08 UTC e35211cdf9cbab770a1065653b7f3e4e58ab46de
1 file changed +7 -5
src/sys_fs_cgroup.c
+7 -5
@@ -822,9 +822,9 @@ void mark_all_cgroups_as_not_available() {
822 }
823
824 void cleanup_all_cgroups() {
825 - struct cgroup *cg, *last;
825 + struct cgroup *cg = cgroup_root, *last = NULL;
826
827 - for(cg = cgroup_root, last = NULL; cg ; last = cg) {
827 + for(; cg ;) {
828 if(!cg->available) {
829
830 if(!last)
@@ -838,10 +838,12 @@ void cleanup_all_cgroups() {
838 cg = cgroup_root;
839 else
840 cg = last->next;
841 -
842 - continue;
841 +
842 + }
843 + else {
844 + last = cg;
845 + cg = cg->next;
846 }
844 - cg = cg->next;
847 }
848 }
849