[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] cpu: Fix memory leaks in x86FeatureLoad and x86ModelLoad



> > diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> > index af0a65b..7c50261 100644
> > --- a/src/cpu/cpu_x86.c
> > +++ b/src/cpu/cpu_x86.c
> > @@ -274,6 +274,7 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
> >  {
> >      struct x86_map *map = data;
> >      xmlNodePtr *nodes = NULL;
> > +    xmlNodePtr ctxt_node = ctxt->node;
> >      struct x86_feature *feature = NULL;
> >      int ret = 0;
> >      int i;
> > @@ -340,6 +341,9 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
> >      }
> >  
> >  out:
> > +    ctxt->node = ctxt_node;
> > +    VIR_FREE(nodes);
> > +
> >      return ret;
> 
>   ah, right we are changing ctxt->node there, good catch !

Although this function is expected to change ctxt->node so the caller sets it
to its original value after x86FeatureLoad returns. But this can't hurt.

Good catch with VIR_FREE(nodes), I forgot to do so.

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]