On Wed, 15 Feb 2012 10:04:50 +0100 Paolo Bonzini <pbonz...@redhat.com> wrote:
> On 02/10/2012 08:31 PM, Luiz Capitulino wrote: > > + err_new = g_malloc0(sizeof(*err)); > > + err_new->obj = qdict_copy(err->obj); > > + err_new->msg = g_strdup(err->msg); > > + err_new->fmt = err->fmt; > > + > > + return err_new; > > +} > > Why isn't an incref sufficient? You know, I'm looking at the code right now and can't answer myself that question :-) I think what wanted to do was to duplicate the Error object and just ended up duplicating everything... > QDicts should be constant once they've > been built. I think you meant QErrors? > (Also, I would refcount Errors rather than copy them, but > that's a personal preference and I do not really object to error_copy). The Error object doesn't have refcounts and I'd prefer to just duplicate it for now (instead of adding it).