aboutsummaryrefslogtreecommitdiff
path: root/lib/netdev-linux.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2013-07-25 17:03:03 -0700
committerBen Pfaff <blp@nicira.com>2013-08-02 12:24:18 -0700
commitf61d8d2931806eae5b25ed8bdd5ff4cf43afe776 (patch)
tree63648ac3d006e28dbf3b96e43a1175c340c20402 /lib/netdev-linux.c
parent59e0c910d043a8f91abc429925f53d34912dac09 (diff)
netdev-linux: Fix fd leak on error path.
Found by inspection. Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/netdev-linux.c')
-rw-r--r--lib/netdev-linux.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 301a7544..0baa40f2 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: