From: Ben Pfaff Date: Tue, 18 Dec 2012 21:41:49 +0000 (-0800) Subject: ofproto, ofproto-dpif: Fix memory leaks of struct iface_hint structures. X-Git-Tag: sliver-openvswitch-1.9.90-3~10^2~81 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=4f9e08a539f26b008f32a33b86ef8c46f5c5bab9;p=sliver-openvswitch.git ofproto, ofproto-dpif: Fix memory leaks of struct iface_hint structures. Signed-off-by: Ben Pfaff --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 6ce9a07c4..578e6d7db 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -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); } } diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index f95d6efc9..a85a6816c 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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); } }