Acked-by: Alex Wang <al...@nicira.com>

On Tue, Aug 18, 2015 at 8:24 AM, Russell Bryant <rbry...@redhat.com> wrote:

> The static result of default_db() was malloc'd but not freed before
> exit.  Make the static result global and free it before exit.
>
> Signed-off-by: Russell Bryant <rbry...@redhat.com>
> ---
>  ovn/northd/ovn-northd.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
> index 554dba3..9d3d658 100644
> --- a/ovn/northd/ovn-northd.c
> +++ b/ovn/northd/ovn-northd.c
> @@ -1016,14 +1016,16 @@ ovnsb_db_changed(struct northd_context *ctx)
>      hmap_destroy(&lports_hmap);
>  }
>
> +
> +static char *default_db_;
> +
>  static const char *
>  default_db(void)
>  {
> -    static char *def;
> -    if (!def) {
> -        def = xasprintf("unix:%s/db.sock", ovs_rundir());
> +    if (!default_db_) {
> +        default_db_ = xasprintf("unix:%s/db.sock", ovs_rundir());
>      }
> -    return def;
> +    return default_db_;
>  }
>
>  static void
> @@ -1322,6 +1324,8 @@ main(int argc, char *argv[])
>      ovsdb_idl_destroy(ovnnb_idl);
>      service_stop();
>
> +    free(default_db_);
> +
>      exit(res);
>  }
>
> --
> 2.4.3
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to