libcontainer: close seccomp agent connection to prevent resource leaks

Add missing defer conn.Close().

Signed-off-by: Pavel Liubimov <prlyubimov@gmail.com>
(cherry picked from commit aa0e7989c4)
Signed-off-by: Pavel Liubimov <prlyubimov@gmail.com>
This commit is contained in:
Pavel Liubimov
2025-07-01 12:22:07 +03:00
parent 4b09b7d1d7
commit ce4ad9922b

View File

@@ -872,6 +872,7 @@ func sendContainerProcessState(listenerPath string, state *specs.ContainerProces
if err != nil { if err != nil {
return fmt.Errorf("failed to connect with seccomp agent specified in the seccomp profile: %w", err) return fmt.Errorf("failed to connect with seccomp agent specified in the seccomp profile: %w", err)
} }
defer conn.Close()
socket, err := conn.(*net.UnixConn).File() socket, err := conn.(*net.UnixConn).File()
if err != nil { if err != nil {