bridge: Avoid memory leak from RSPAN mirrors in bridge_destroy().
authorBen Pfaff <blp@nicira.com>
Mon, 11 Apr 2011 18:22:39 +0000 (11:22 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 29 Apr 2011 21:32:00 +0000 (14:32 -0700)
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

index a95a458..4be0d1e 100644 (file)
@@ -1728,10 +1728,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);