jail: correctly check for null pointer
authorPhilipp Meier <philipp.meier@westermo.com>
Tue, 8 Nov 2022 13:38:37 +0000 (14:38 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 10 Nov 2022 20:17:00 +0000 (20:17 +0000)
Handle case where opts.sysctl is not used.

Signed-off-by: Philipp Meier <philipp.meier@westermo.com>
jail/jail.c

index ce6b268ea28e1f2aa6768eed0cd24e70be5229f8..31b64e5ddb565e83378dd01cc7f46e8e899505bd 100644 (file)
@@ -215,6 +215,10 @@ static void free_hooklist(struct hook_execvpe **hooklist)
 
 static void free_sysctl(void) {
        struct sysctl_val *cur;
+
+       if (!opts.sysctl)
+               return;
+
        cur = *opts.sysctl;
 
        while (cur) {