From: Ben Pfaff Date: Fri, 26 Jul 2013 00:03:03 +0000 (-0700) Subject: netdev-linux: Fix fd leak on error path. X-Git-Tag: sliver-openvswitch-2.0.90-1~33^2~44 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=f61d8d2931806eae5b25ed8bdd5ff4cf43afe776;p=sliver-openvswitch.git netdev-linux: Fix fd leak on error path. Found by inspection. Signed-off-by: Ben Pfaff --- 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: