[ovs-dev] [leaks 6/7] classifier: Fix theoretical leak in classifier_destroy().

Ethan Jackson ethan at nicira.com
Thu Jan 10 01:28:04 UTC 2013


Acked-by: Ethan Jackson <ethan at nicira.com>


On Wed, Dec 26, 2012 at 12:38 PM, Ben Pfaff <blp at nicira.com> wrote:

> The open-coded version of destroy_table() in classifier_destroy() didn't
> free the table's minimatch.  Use destroy_table() to do it properly.
>
> This is only a theoretical leak because all the existing callers actually
> remove all the rules from their classifiers before they destroy them
> (outside of the tests/ directory, which I didn't examine) and so they don't
> ever have anything left to remove in classifier_destroy().
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  lib/classifier.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/lib/classifier.c b/lib/classifier.c
> index e5d226e..d1fe524 100644
> --- a/lib/classifier.c
> +++ b/lib/classifier.c
> @@ -146,9 +146,7 @@ classifier_destroy(struct classifier *cls)
>          struct cls_table *table, *next_table;
>
>          HMAP_FOR_EACH_SAFE (table, next_table, hmap_node, &cls->tables) {
> -            hmap_destroy(&table->rules);
> -            hmap_remove(&cls->tables, &table->hmap_node);
> -            free(table);
> +            destroy_table(cls, table);
>          }
>          hmap_destroy(&cls->tables);
>      }
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130109/b247f883/attachment-0003.html>


More information about the dev mailing list