From 614bb96676aa9405184040811c6ea82bac15fb8e Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Mon, 13 Apr 2020 08:32:08 -0700 Subject: [PATCH] cgroupv2/systemd: Properly remove intermediate directory Signed-off-by: Ted Yu --- libcontainer/cgroups/systemd/unified_hierarchy.go | 1 + 1 file changed, 1 insertion(+) diff --git a/libcontainer/cgroups/systemd/unified_hierarchy.go b/libcontainer/cgroups/systemd/unified_hierarchy.go index 2dffc34e0..36ccf2716 100644 --- a/libcontainer/cgroups/systemd/unified_hierarchy.go +++ b/libcontainer/cgroups/systemd/unified_hierarchy.go @@ -241,6 +241,7 @@ func createCgroupsv2Path(path string) (Err error) { } } else { // If the directory was created, be sure it is not left around on errors. + current := current defer func() { if Err != nil { os.Remove(current)