From f61d8d2931806eae5b25ed8bdd5ff4cf43afe776 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 25 Jul 2013 17:03:03 -0700 Subject: [PATCH] netdev-linux: Fix fd leak on error path. Found by inspection. Signed-off-by: Ben Pfaff --- lib/netdev-linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 301a7544d..0baa40f2e 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -672,19 +672,21 @@ netdev_linux_create_tap(const struct netdev_class *class OVS_UNUSED, VLOG_WARN("%s: creating tap device failed: %s", name, ovs_strerror(errno)); error = errno; - goto error_unref_notifier; + goto error_close; } /* Make non-blocking. */ error = set_nonblocking(state->fd); if (error) { - goto error_unref_notifier; + goto error_close; } netdev_init(&netdev->up, name, &netdev_tap_class); *netdevp = &netdev->up; return 0; +error_close: + close(state->fd); error_unref_notifier: cache_notifier_unref(); error: -- 2.43.0