From: Ben Pfaff Date: Mon, 11 Apr 2011 18:22:39 +0000 (-0700) Subject: bridge: Avoid memory leak from RSPAN mirrors in bridge_destroy(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f76e2dfc8a1dd2581629a0a23c40cc43a77485d3;p=openvswitch 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. --- 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);