]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fix memory leak in F5 config parsing
authorDavid Woodhouse <dwmw2@infradead.org>
Tue, 13 Apr 2021 04:08:24 +0000 (05:08 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Tue, 13 Apr 2021 08:55:10 +0000 (09:55 +0100)
Wouldn't this be easier in C++? Or maybe Rust?

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
f5.c

diff --git a/f5.c b/f5.c
index 7023d99f31c9d4366f990ccd3f069709953a2b0d..d7c0332af83410abf565779fb87d5743819f60bc 100644 (file)
--- a/f5.c
+++ b/f5.c
@@ -421,6 +421,7 @@ static int parse_options(struct openconnect_info *vpninfo, char *buf, int len,
                        }
                } else if (   (!strncmp((char *)xml_node->name, "LAN", 3) && isdigit((char)xml_node->name[3]))
                           || (!strncmp((char *)xml_node->name, "LAN6_", 5) && isdigit((char)xml_node->name[5]))) {
+                       free(s);
                        s = (char *)xmlNodeGetContent(xml_node);
                        if (s && *s) {
                                char *word, *next;