[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/12] l2tpv3: fix fd leak
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 03/12] l2tpv3: fix fd leak |
Date: |
Mon, 17 Nov 2014 18:08:10 +0100 |
From: Gonglei <address@hidden>
In this false branch, fd will leak when it is zero.
Change the testing condition.
Signed-off-by: Gonglei <address@hidden>
[Fix net_l2tpv3_cleanup as well. - Paolo]
Signed-off-by: Paolo Bonzini <address@hidden>
---
net/l2tpv3.c | 4 ++--
1 file 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) {
--
1.8.3.1
- [Qemu-devel] [PULL 00/12] Coverity fixes for 2.2.0-rc2, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 01/12] libcacard: fix resource leak, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 02/12] l2tpv3: fix possible double free, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 03/12] l2tpv3: fix fd leak,
Paolo Bonzini <=
- [Qemu-devel] [PULL 04/12] mips_mipssim: fix use-after-free for filename, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 06/12] loader: fix NEGATIVE_RETURNS, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 05/12] qga: fix false negative argument passing, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 07/12] nvme: remove superfluous check, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 08/12] acl: fix memory leak, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 09/12] qemu-char: fix MISSING_COMMA, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 10/12] shpc: fix error propaagation, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 11/12] target-cris/translate.c: fix out of bounds read, Paolo Bonzini, 2014/11/17
- [Qemu-devel] [PULL 12/12] hcd-musb: fix dereference null return value, Paolo Bonzini, 2014/11/17
- Re: [Qemu-devel] [PULL 00/12] Coverity fixes for 2.2.0-rc2, Peter Maydell, 2014/11/17