[Openvpn-devel] fix memory leak in add_route_ipv6.

Message ID 20210714131810.9473-1-david@adalogics.com
State Superseded
Headers show
Series
  • [Openvpn-devel] fix memory leak in add_route_ipv6.
Related show

Commit Message

david korczynski July 14, 2021, 1:18 p.m.
---
 src/openvpn/route.c | 1 +
 1 file changed, 1 insertion(+)

--
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

Comments

Gert Doering July 14, 2021, 1:43 p.m. | #1
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 <david@adalogics.com>", which
   might be intentional or not)

gert


On Wed, Jul 14, 2021 at 02:18:10PM +0100, davkor wrote:
> ---
>  src/openvpn/route.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/openvpn/route.c b/src/openvpn/route.c
> index 56fa7717..3b2af8b4 100644
> --- a/src/openvpn/route.c
> +++ b/src/openvpn/route.c
> @@ -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
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 56fa7717..3b2af8b4 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -1891,6 +1891,7 @@  add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,

     if (!(r6->flags & RT_DEFINED) )
     {
+        argv_free(&argv);
         return;
     }