On Thu, Jun 30, 2016 at 09:37:29PM -0700, Darrell Ball wrote:
> On Thu, Jun 30, 2016 at 2:31 PM, William Tu <u9012...@gmail.com> wrote:
> 
> > Hi Darrell,
> >
> > Thanks, I think we should print the error in VLOG_WARN and free it .
> >
> > Regards,
> > William
> >
> 
> Thanks
> I only commented on grabbing the error return value and allowing it to be
> freed instead
> of removing the free() call to satisfy the clang warning.
> 
> If you think also adding the error returned is helpful to add to the
> existing below warn
> log, then probably best to check with the author of the code, but I agree
> with you.
> 
> >                 VLOG_WARN("router "UUID_FMT" (%s) has invalid prefix: %s",
> >                           UUID_ARGS(&lr->header_.uuid), lr->name,
> >                           route->ip_prefix);

Thanks for the discussion.  I fixed this up as the following and applied
it to master.

--8<--------------------------cut here-------------------------->8--

From: William Tu <u9012...@gmail.com>
Date: Tue, 28 Jun 2016 22:02:26 -0700
Subject: [PATCH] ovn-nbctl: Fix double free in nbctl_lr_route_list().

The intent here was to free the error reported by ipv6_parse_cidr(),
but in fact the error reported by that function was discarded and
the previous error from ip_parse_cidr() was freed again.

Signed-off-by: William Tu <u9012...@gmail.com>
Signed-off-by: Ben Pfaff <b...@ovn.org>
---
 ovn/utilities/ovn-nbctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index abeba0b..8fefd69 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -1799,7 +1799,8 @@ nbctl_lr_route_list(struct ctl_context *ctx)
             free(error);
 
             struct in6_addr ipv6;
-            if (!ipv6_parse_cidr(route->ip_prefix, &ipv6, &plen)) {
+            error = ipv6_parse_cidr(route->ip_prefix, &ipv6, &plen);
+            if (!error) {
                 ipv6_routes[n_ipv6_routes].plen = plen;
                 ipv6_routes[n_ipv6_routes].addr = ipv6;
                 ipv6_routes[n_ipv6_routes].route = route;
-- 
2.1.3
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to