aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-11-15 18:06:40 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-11-17 11:40:36 +0100
commitd4754a953196516b16beef707dcdfdb35c2eec6e (patch)
tree705910aa59e3ef3a806cd5cd11472e2f09cf51bb /net
parent77374582ab961af2c5e702f767f52179d5f7676c (diff)
downloadqemu-d4754a953196516b16beef707dcdfdb35c2eec6e.zip
qemu-d4754a953196516b16beef707dcdfdb35c2eec6e.tar.gz
qemu-d4754a953196516b16beef707dcdfdb35c2eec6e.tar.bz2
l2tpv3: fix fd leak
In this false branch, fd will leak when it is zero. Change the testing condition. Signed-off-by: Gonglei <arei.gonglei@huawei.com> [Fix net_l2tpv3_cleanup as well. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/l2tpv3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index 65db5ef..3b805a7 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -516,7 +516,7 @@ static void net_l2tpv3_cleanup(NetClientState *nc)
qemu_purge_queued_packets(nc);
l2tpv3_read_poll(s, false);
l2tpv3_write_poll(s, false);
- if (s->fd > 0) {
+ if (s->fd >= 0) {
close(s->fd);
}
destroy_vector(s->msgvec, MAX_L2TPV3_MSGCNT, IOVSIZE);
@@ -745,7 +745,7 @@ int net_init_l2tpv3(const NetClientOptions *opts,
return 0;
outerr:
qemu_del_net_client(nc);
- if (fd > 0) {
+ if (fd >= 0) {
close(fd);
}
if (result) {