[ovs-dev] [leaks 4/4] ofproto, ofproto-dpif: Fix memory leaks of struct iface_hint structures.
Justin Pettit
jpettit at nicira.com
Tue Dec 18 22:36:17 UTC 2012
Looks good. Thanks!
--Justin
On Dec 18, 2012, at 1:51 PM, Ben Pfaff <blp at nicira.com> wrote:
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> 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 6ce9a07..578e6d7 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 f95d6ef..a85a681 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);
> }
> }
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list