From 4f9e08a539f26b008f32a33b86ef8c46f5c5bab9 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 18 Dec 2012 13:41:49 -0800 Subject: [PATCH] ofproto, ofproto-dpif: Fix memory leaks of struct iface_hint structures. Signed-off-by: Ben Pfaff --- ofproto/ofproto-dpif.c | 3 ++- ofproto/ofproto.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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); } } -- 2.47.0