diff mbox

[ovs-dev,rebase,1/3] ovn-controller: Fix memory leak when updating tunnels.

Message ID 1470961234-90115-2-git-send-email-jesse@kernel.org
State Accepted
Headers show

Commit Message

Jesse Gross Aug. 12, 2016, 12:20 a.m. UTC
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(-)

Comments

Ryan Moats Aug. 12, 2016, 1:59 a.m. UTC | #1
"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>
Ben Pfaff Aug. 12, 2016, 3:59 a.m. UTC | #2
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 mbox

Patch

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);
         }