jail: seccomp-oci: fix uninitialized pointer read in error path
authorDaniel Golle <daniel@makrotopia.org>
Fri, 27 Sep 2024 13:13:52 +0000 (14:13 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 6 Jan 2025 23:46:55 +0000 (23:46 +0000)
The pointer to allocated memory 'filter' has not been assigned to
'prog->filter' when error path errout1 is used. Free 'filter' instead
of 'prog->filter' in that case.

Coverity CID 1520949 Uninitialized pointer read
Coverity CID 1521044 Resource leak
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
jail/seccomp-oci.c

index 9ef43d111dcd2da648923025c711ca77e3bf6c4b..c279fc12a561cdd84c37361966ea05eaaeabf13b 100644 (file)
@@ -422,7 +422,7 @@ struct sock_fprog *parseOCIlinuxseccomp(struct blob_attr *msg)
        return prog;
 
 errout1:
-       free(prog->filter);
+       free(filter);
 errout2:
        free(prog);
        return NULL;