From 6ac151d69be162631cb03e9107148c03670773df Mon Sep 17 00:00:00 2001 From: lifubang Date: Tue, 18 Nov 2025 04:53:19 +0000 Subject: [PATCH] libct: add a defer fd close in createDeviceNode Signed-off-by: lifubang --- libcontainer/rootfs_linux.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libcontainer/rootfs_linux.go b/libcontainer/rootfs_linux.go index 5128159bc..9f2af0a21 100644 --- a/libcontainer/rootfs_linux.go +++ b/libcontainer/rootfs_linux.go @@ -995,6 +995,8 @@ func createDeviceNode(rootfs string, node *devices.Device, bind bool) error { if err != nil { return fmt.Errorf("mkdir parent of device inode %q: %w", node.Path, err) } + defer destDir.Close() + if bind { return bindMountDeviceNode(destDir, destName, node) }