jail: only free cgroups if they were allocated
authorDaniel Golle <daniel@makrotopia.org>
Thu, 6 Aug 2020 14:34:27 +0000 (15:34 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 6 Aug 2020 14:34:27 +0000 (15:34 +0100)
Fixes segfault on shutdown with slim containers.

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

index d59afa522387aef4d55a2121b2b8cdd0aa601ba3..42b2d3ff1b5cd18d87c35358d30360810ebb019b 100644 (file)
@@ -260,7 +260,8 @@ static void free_opts(bool parent) {
                        free(*(tmp++));
 
                free(opts.envp);
-               cgroups_free();
+               if (opts.ocibundle)
+                       cgroups_free();
        };
 
        free_rlimits();