jail: always call cgroups_free()
authorDaniel Golle <daniel@makrotopia.org>
Sun, 29 Nov 2020 23:21:04 +0000 (23:21 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 30 Nov 2020 00:25:47 +0000 (00:25 +0000)
In commit 3019f50 ("jail: leak less memory") memory handling in cgroups
related code was refactored. That allows to call cgroups_free()
unconditionally and remove the child-branch of in free_opts().

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
jail/jail.c

index 82ba4a59eb96f20fe92b4a801269382a808fb9e7..529ac6b9ff53abe0fde209bd1a2151a34b396d98 100644 (file)
@@ -249,6 +249,7 @@ static void free_opts(bool parent) {
 
        free_library_search();
        mount_free();
+       cgroups_free();
 
        /* we need to keep argv, envp and seccomp filter in child */
        if (parent) { /* parent-only */
@@ -259,9 +260,6 @@ static void free_opts(bool parent) {
 
                free_oci_envp(opts.jail_argv);
                free_oci_envp(opts.envp);
-       } else { /* child-only */
-               if (opts.ocibundle)
-                       cgroups_free();
        }
 
        free_rlimits();