diff options
author | yuanjungong | 2020-11-19 10:25:32 +0100 |
---|---|---|
committer | Jason Wang | 2020-11-24 03:40:17 +0100 |
commit | f012bec8909820390936f1cf68b3e73a2d4ac966 (patch) | |
tree | 53c8dbf61b4434acb699dc63e29ace951faebb00 | |
parent | net: purge queued rx packets on queue deletion (diff) | |
download | qemu-f012bec8909820390936f1cf68b3e73a2d4ac966.tar.gz qemu-f012bec8909820390936f1cf68b3e73a2d4ac966.tar.xz qemu-f012bec8909820390936f1cf68b3e73a2d4ac966.zip |
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>
-rw-r--r-- | net/tap.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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) { |