ofproto, ofproto-dpif: Fix memory leaks of struct iface_hint structures.
authorBen Pfaff <blp@nicira.com>
Tue, 18 Dec 2012 21:41:49 +0000 (13:41 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 18 Dec 2012 23:52:23 +0000 (15:52 -0800)
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif.c
ofproto/ofproto.c

index 6ce9a07..578e6d7 100644 (file)
@@ -1124,7 +1124,7 @@ construct(struct ofproto *ofproto_)
     ofproto->port_poll_errno = 0;
 
     SHASH_FOR_EACH_SAFE (node, next, &init_ofp_ports) {
-        const struct iface_hint *iface_hint = node->data;
+        struct iface_hint *iface_hint = node->data;
 
         if (!strcmp(iface_hint->br_name, ofproto->up.name)) {
             /* Check if the datapath already has this port. */
@@ -1134,6 +1134,7 @@ construct(struct ofproto *ofproto_)
 
             free(iface_hint->br_name);
             free(iface_hint->br_type);
+            free(iface_hint);
             shash_delete(&init_ofp_ports, node);
         }
     }
index f95d6ef..a85a681 100644 (file)
@@ -2018,11 +2018,12 @@ init_ports(struct ofproto *p)
     }
 
     SHASH_FOR_EACH_SAFE(node, next, &init_ofp_ports) {
-        const struct iface_hint *iface_hint = node->data;
+        struct iface_hint *iface_hint = node->data;
 
         if (!strcmp(iface_hint->br_name, p->name)) {
             free(iface_hint->br_name);
             free(iface_hint->br_type);
+            free(iface_hint);
             shash_delete(&init_ofp_ports, node);
         }
     }