mirror of
https://github.com/qemu/qemu.git
synced 2024-11-30 23:33:51 +08:00
tap: fix a memory leak
Close fd before returning. Buglink: https://bugs.launchpad.net/qemu/+bug/1904486 Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
d2abc563e4
commit
f012bec890
@ -817,6 +817,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
|
||||
name, fd);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -831,6 +832,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
|
||||
vhostfdname, vnet_hdr, fd, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
} else if (tap->has_fds) {
|
||||
|
Loading…
Reference in New Issue
Block a user