aboutsummaryrefslogtreecommitdiff
path: root/net/tap.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tap.c')
-rw-r--r--net/tap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/tap.c b/net/tap.c
index a40f7f023f..bde6b58b17 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -598,7 +598,6 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
if (!s) {
- close(fd);
return -1;
}
@@ -797,6 +796,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
if (net_init_tap_one(tap, peer, "bridge", name, ifname,
script, downscript, vhostfdname,
vnet_hdr, fd)) {
+ close(fd);
return -1;
}
} else {
@@ -824,6 +824,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
if (queues > 1 && i == 0 && !tap->has_ifname) {
if (tap_fd_get_ifname(fd, ifname)) {
error_report("Fail to get ifname");
+ close(fd);
return -1;
}
}
@@ -832,6 +833,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
i >= 1 ? "no" : script,
i >= 1 ? "no" : downscript,
vhostfdname, vnet_hdr, fd)) {
+ close(fd);
return -1;
}
}