tun: don't leak the QueueSet shutdown eventfd when Add fails

Both newTunGeneric error branches closed only the tun fd; the
Add-failure branch left the freshly created QueueSet (and its
shutdown eventfd) orphaned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ugV2edVqoz3tBvq9J6yWp
This commit is contained in:
JackDoan
2026-07-29 17:12:46 -05:00
parent 7455ac56eb
commit 9ce0596f5c
+3
View File
@@ -242,7 +242,10 @@ func newTunGeneric(c *config.C, l *slog.Logger, fd int, vnetHdr bool, offloadFla
}
err = qs.Add(fd)
if err != nil {
// Add only appends on success, so closing the set here can't
// double-close fd; it releases the set's shutdown eventfd.
_ = unix.Close(fd)
_ = qs.Close()
return nil, err
}