qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] l2tpv3: fix possible double free
@ 2014-11-14  1:39 zhanghailiang
  2014-11-14  3:03 ` Gonglei
  2014-11-14  8:45 ` Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: zhanghailiang @ 2014-11-14  1:39 UTC (permalink / raw)
  To: qemu-trivial; +Cc: zhanghailiang, qemu-devel, stefanha, peter.huangpeng

freeaddrinfo(result) does not assign result = NULL, after frees it.
There will be a double free when it goes error case.
It is reported by covertiy.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
 net/l2tpv3.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index 528d95b..f9e0c98 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -661,6 +661,7 @@ int net_init_l2tpv3(const NetClientOptions *opts,
         fd = -errno;
         error_report("l2tpv3_open : socket creation failed, errno = %d", -fd);
         freeaddrinfo(result);
+        result = NULL;
         goto outerr;
     }
     if (bind(fd, (struct sockaddr *) result->ai_addr, result->ai_addrlen)) {
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-17  5:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14  1:39 [Qemu-devel] [PATCH] l2tpv3: fix possible double free zhanghailiang
2014-11-14  3:03 ` Gonglei
2014-11-14  8:45 ` Paolo Bonzini
2014-11-17  5:13   ` zhanghailiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).