diff mbox

[ovs-dev] Free port bindings when deleting cached ports.

Message ID 20170714192724.18155-1-mmichels@redhat.com
State Accepted
Headers show

Commit Message

Mark Michelson July 14, 2017, 7:27 p.m. UTC
Running test "ovn-controller-vtep binding 2" with address sanitizer
enabled resulted in a failure due to a memory leak. The cached switch
port's bindings were not being freed when the port was freed. The
fix is to destroy the bindings hash table when the switch port is
freed.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Reported-by: Lance Richardson <lrichard@redhat.com>
---
 vtep/vtep-ctl.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ben Pfaff July 14, 2017, 9:45 p.m. UTC | #1
On Fri, Jul 14, 2017 at 02:27:24PM -0500, Mark Michelson wrote:
> Running test "ovn-controller-vtep binding 2" with address sanitizer
> enabled resulted in a failure due to a memory leak. The cached switch
> port's bindings were not being freed when the port was freed. The
> fix is to destroy the bindings hash table when the switch port is
> freed.
> 
> Signed-off-by: Mark Michelson <mmichels@redhat.com>
> Reported-by: Lance Richardson <lrichard@redhat.com>

Applied to master, thanks!
diff mbox

Patch

diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index bbdf57fad..17afa0c59 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -542,6 +542,7 @@  del_cached_port(struct vtep_ctl_context *vtepctl_ctx,
     ovs_list_remove(&port->ports_node);
     shash_find_and_delete(&vtepctl_ctx->ports, cache_name);
     vteprec_physical_port_delete(port->port_cfg);
+    shash_destroy(&port->bindings);
     free(cache_name);
     free(port);
 }