From f76e2dfc8a1dd2581629a0a23c40cc43a77485d3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 11 Apr 2011 11:22:39 -0700 Subject: [PATCH] bridge: Avoid memory leak from RSPAN mirrors in bridge_destroy(). Mirrors that output to ports will be destroyed when their output ports are destroyed, but mirrors that output to VLANs ("RSPAN" mirrors) don't get automatically destroyed like this and we need to take care of them in a separate loop. --- vswitchd/bridge.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index f5918be0..2b8b2482 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1696,10 +1696,14 @@ bridge_destroy(struct bridge *br) if (br) { struct port *port, *next; int error; + int i; HMAP_FOR_EACH_SAFE (port, next, hmap_node, &br->ports) { port_destroy(port); } + for (i = 0; i < MAX_MIRRORS; i++) { + mirror_destroy(br->mirrors[i]); + } list_remove(&br->node); ofproto_destroy(br->ofproto); error = dpif_delete(br->dpif); -- 2.30.2