[ovs-dev] [PATCH] ovsdb-idl: Fix memory leak in ovsdb_idl_condition_add_clause().

Flaviof flavio at flaviof.com
Mon Aug 15 19:08:04 UTC 2016


On Sat, Aug 13, 2016 at 7:58 PM, Ben Pfaff <blp at ovn.org> wrote:

> The function always allocated a clause but didn't use it if it was
> going to be a duplicate.
>
> Signed-off-by: Ben Pfaff <blp at ovn.org>
>

Acked-by: Flavio Fernandes <flavio at flaviof.com>



> ---
>  lib/ovsdb-idl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> index ad0d1e1..7d3d328 100644
> --- a/lib/ovsdb-idl.c
> +++ b/lib/ovsdb-idl.c
> @@ -769,7 +769,6 @@ void ovsdb_idl_condition_add_clause(struct ovsdb_idl
> *idl,
>                                      struct ovsdb_datum *arg)
>  {
>      struct ovsdb_idl_table *table = ovsdb_idl_table_from_class(idl, tc);
> -    struct ovsdb_idl_clause *clause = xzalloc(sizeof *clause);
>      const struct ovsdb_type *type = NULL;
>      struct ovsdb_idl_clause *c;
>
> @@ -782,6 +781,7 @@ void ovsdb_idl_condition_add_clause(struct ovsdb_idl
> *idl,
>          }
>      }
>
> +    struct ovsdb_idl_clause *clause = xzalloc(sizeof *clause);
>      ovs_list_init(&clause->node);
>      clause->function = function;
>      clause->column = column;
> --
> 2.1.3
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list