Message ID | 1470961234-90115-2-git-send-email-jesse@kernel.org |
---|---|
State | Accepted |
Headers | show |
"dev" <dev-bounces@openvswitch.org> wrote on 08/11/2016 07:20:32 PM: > From: Jesse Gross <jesse@kernel.org> > To: dev@openvswitch.org > Date: 08/11/2016 07:21 PM > Subject: [ovs-dev] [PATCH rebase 1/3] ovn-controller: Fix memory > leak when updating tunnels. > Sent by: "dev" <dev-bounces@openvswitch.org> > > When a tunnel possibly needs to be updated, we are currently allocating > a new name for it. This is not necessary and in fact nothing uses the > name, which then results in the memory being leaked. > > Fixes: 1d45d5a9 ("ovn-controller: Change encaps_run to work incrementally.") > Signed-off-by: Jesse Gross <jesse@kernel.org> > --- Good catch... Acked-by: Ryan Moats <rmoats@us.ibm.com>
On Thu, Aug 11, 2016 at 05:20:32PM -0700, Jesse Gross wrote: > When a tunnel possibly needs to be updated, we are currently allocating > a new name for it. This is not necessary and in fact nothing uses the > name, which then results in the memory being leaked. > > Fixes: 1d45d5a9 ("ovn-controller: Change encaps_run to work incrementally.") > Signed-off-by: Jesse Gross <jesse@kernel.org> Weird. Good catch. Acked-by: Ben Pfaff <blp@ovn.org>
diff --git a/ovn/controller/encaps.c b/ovn/controller/encaps.c index 3bb8ae4..6623f19 100644 --- a/ovn/controller/encaps.c +++ b/ovn/controller/encaps.c @@ -309,12 +309,7 @@ check_and_update_tunnel(const struct sbrec_chassis *chassis_rec) const struct sbrec_encap *encap = preferred_encap(chassis_rec); const struct ovsrec_port *port = port_node->port; const struct ovsrec_interface *iface = port->interfaces[0]; - char *port_name = tunnel_create_name(chassis_rec->name); - if (!port_name) { - VLOG_WARN("Unable to allocate unique name for '%s' tunnel", - chassis_rec->name); - return; - } + if (strcmp(encap->type, iface->type)) { ovsrec_interface_set_type(iface, encap->type); }
When a tunnel possibly needs to be updated, we are currently allocating a new name for it. This is not necessary and in fact nothing uses the name, which then results in the memory being leaked. Fixes: 1d45d5a9 ("ovn-controller: Change encaps_run to work incrementally.") Signed-off-by: Jesse Gross <jesse@kernel.org> --- ovn/controller/encaps.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)