[XS] Change in openvpn[master]: dns: Fix memory leak in dns_server_addr_parse

"cron2 \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1712?usp=email )

Change subject: dns: Fix memory leak in dns_server_addr_parse
......................................................................

dns: Fix memory leak in dns_server_addr_parse

When the DNS server's address count is already full (exceeds the
limit of 8), the function returned early without freeing the
successfully resolved addrinfo struct. Fix this by checking the
limit before executing the DNS lookup.

Github: OpenVPN/openvpn#1055
Change-Id: I7ec318c86af994284d1c6272e3bbe2b1ede160fd
Signed-off-by: saddamr3e <[email protected]>
Acked-by: Heiko Hund <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1712
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg37209.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/dns.c
1 file changed, 3 insertions(+), 3 deletions(-)




diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c
index 954ed52..1465cdf 100644
--- a/src/openvpn/dns.c
+++ b/src/openvpn/dns.c
@@ -114,13 +114,13 @@
         addr = addrcopy;
     }
 
-    struct addrinfo *ai = NULL;
-    if (openvpn_getaddrinfo(0, addr, NULL, 0, NULL, af, &ai) != 0)
+    if (server->addr_count >= SIZE(server->addr))
     {
         return false;
     }
 
-    if (server->addr_count >= SIZE(server->addr))
+    struct addrinfo *ai = NULL;
+    if (openvpn_getaddrinfo(0, addr, NULL, 0, NULL, af, &ai) != 0)
     {
         return false;
     }

-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1712?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7ec318c86af994284d1c6272e3bbe2b1ede160fd
Gerrit-Change-Number: 1712
Gerrit-PatchSet: 3
Gerrit-Owner: cron2 <[email protected]>
Gerrit-Reviewer: d12fk <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.