Skip to contentSkip to conversation

fix memory leak in add_route_ipv6.

PATCH In review davkor 2 participants 2 messages Jul 14, 2021

lore
Share & tools
lore

davkor

author
#0 lore raw

PATCH 1/1 fix memory leak in add_route_ipv6.

---
 src/openvpn/route.c | 1 +
 1 file changed, 1 insertion(+)
src/openvpn/route.c +1 -0
index 56fa7717..3b2af8b4 100644
@@ -1891,6 +1891,7 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,
 
     if (!(r6->flags & RT_DEFINED) )
     {
+        argv_free(&argv);
         return;
     }
 

--
2.17.1

ADA Logics Ltd is registered in England. No: 11624074. Registered office: 266 Banbury Road, Post Box 292, OX2 7DL, Oxford, Oxfordshire , United Kingdom

#1 lore raw

Hi,

thanks for the patch. Well spotted :-)

Two things:

- I see that the code in add_route() is the same...

    struct argv argv = argv_new();
...
    if (!(r->flags & RT_DEFINED))
    {
        return;
    }

so while at it, please send a fix for both places

- if you want, please set your username in git, so it shows a "real name" (right now, we have "davkor <[email protected]...>", which might be intentional or not)

gert

Quoted 29 lines · davkor
---
 src/openvpn/route.c | 1 +
 1 file changed, 1 insertion(+)
src/openvpn/route.c +1 -1
index 56fa7717..3b2af8b4 100644
@@ -1891,6 +1891,7 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,
 
     if (!(r6->flags & RT_DEFINED) )
     {
+        argv_free(&argv);
         return;
     }
 
--

2.17.1

ADA Logics Ltd is registered in England. No: 11624074. Registered office: 266 Banbury Road, Post Box 292, OX2 7DL, Oxford, Oxfordshire , United Kingdom

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...