> From: Stefan Hajnoczi [mailto:stefa...@redhat.com]
> Sent: Monday, September 22, 2014 6:28 PM
> Subject: Re: [Qemu-devel] [PATCH] blkdebug: show an error for invalid event
> names
> 
> On Sat, Sep 20, 2014 at 09:32:35AM +0000, Gonglei (Arei) wrote:
> > > @@ -315,10 +320,21 @@ static int read_config(BDRVBlkdebugState *s,
> const
> > > char *filename,
> > >
> > >      d.s = s;
> > >      d.action = ACTION_INJECT_ERROR;
> > > -    qemu_opts_foreach(&inject_error_opts, add_rule, &d, 0);
> > > +    d.errp = &local_err;
> > > +    qemu_opts_foreach(&inject_error_opts, add_rule, &d, 1);
> > > +    if (local_err) {
> > > +        error_propagate(errp, local_err);
> > > +        ret = -EINVAL;
> > > +        goto fail;
> > > +    }
> > >
> >
> > If this check failed, it don't need to reset &set_state_opts.
> 
> Setting up the rules has failed and we need to free the QemuOpts which
> were built up in this function.
> 
> If we don't free them then there is a memory leak.
> 
Yes. My fault. :( Sorry.

The QemuOpts created in qemu_config_parse(), So they need be freed
If encounter any errors after this calling...

Reviewed-by: Gonglei <arei.gong...@huawei.com>

Best regards,
-Gonglei

Reply via email to