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. Why is it correct to avoid resetting set_state_opts? Stefan
pgpJY_XGrFIuR.pgp
Description: PGP signature