[ovs-dev] [PATCH 2/3] Fix memory leak in nbctl_lr_route_add.

Ben Pfaff blp at ovn.org
Mon Oct 3 19:50:43 UTC 2016


On Mon, Oct 03, 2016 at 10:52:01AM -0700, nickcooper-zhangtonghao wrote:
> Signed-off-by: nickcooper-zhangtonghao <nickcooper-zhangtonghao at opencloud.tech>

This kind of change is just silly, let's not do this:

> @@ -1607,8 +1612,12 @@ nbctl_lr_route_add(struct ctl_context *ctx)
>          }
>  
>          if (!may_exist) {
> +            char errm[60];
> +            snprintf(errm, sizeof errm, "duplicate prefix: %s", prefix);
> +            free(prefix);
> +            free(next_hop);
>              free(rt_prefix);
> -            ctl_fatal("duplicate prefix: %s", prefix);
> +            ctl_fatal("%s", errm);
>          }
>  
>          /* Update the next hop for an existing route. */

Thanks,

Ben.



More information about the dev mailing list