Eelco Chaudron <[email protected]> writes:

> Coverity was flagged that the uninitialized output variable was used
> in the ctl_context_init_command() function. This patch initializes
> the variable.
>
> In addition it also destroys the ds string in ctl_context_done()
> in case it's not cleared properly.
>
> Fixes: 07ff77ccb82a ("db-ctl-base: Make common database command code into 
> library.")
> Signed-off-by: Eelco Chaudron <[email protected]>
> ---

Acked-by: Paolo Valerio <[email protected]>

>  lib/db-ctl-base.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
> index 3a8068b12..b3e9b92d1 100644
> --- a/lib/db-ctl-base.c
> +++ b/lib/db-ctl-base.c
> @@ -2656,6 +2656,7 @@ ctl_context_init(struct ctl_context *ctx, struct 
> ctl_command *command,
>                   struct ovsdb_symbol_table *symtab,
>                   void (*invalidate_cache_cb)(struct ctl_context *))
>  {
> +    ds_init(&ctx->output);
>      if (command) {
>          ctl_context_init_command(ctx, command, false);
>      }
> @@ -2688,6 +2689,7 @@ ctl_context_done(struct ctl_context *ctx,
>          ctl_context_done_command(ctx, command);
>      }
>      invalidate_cache(ctx);
> +    ds_destroy(&ctx->output);
>  }
>  
>  char * OVS_WARN_UNUSED_RESULT
> -- 
> 2.44.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to