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

Re: [libvirt] [PATCHv3 4/8] qemu: bulk stats: implement VCPU group



> > +static int
> > +qemuDomainGetStatsVcpu(virConnectPtr conn ATTRIBUTE_UNUSED,
> > +                       virDomainObjPtr dom,
> > +                       virDomainStatsRecordPtr record,
> > +                       int *maxparams,
> > +                       unsigned int privflags ATTRIBUTE_UNUSED)
> > +{
> > +    size_t i;
> > +    int ret = -1;
> > +    char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
> > +    virVcpuInfoPtr cpuinfo = NULL;
> > +
> > +    if (virTypedParamsAddUInt(&record->params,
> > +                              &record->nparams,
> > +                              maxparams,
> > +                              "vcpu.current",
> > +                              (unsigned) dom->def->vcpus) < 0)
> > +        return -1;
> > +
> > +    if (virTypedParamsAddUInt(&record->params,
> > +                              &record->nparams,
> > +                              maxparams,
> > +                              "vcpu.maximum",
> > +                              (unsigned) dom->def->maxvcpus) < 0)
> > +        return -1;
> > +
> > +    if (VIR_ALLOC_N(cpuinfo, dom->def->vcpus) < 0)
> > +        return -1;
> > +
> > +    if ((ret = qemuDomainHelperGetVcpus(dom,
> > +                                        cpuinfo,
> > +                                        dom->def->vcpus,
> > +                                        NULL,
> > +                                        0)) < 0)
> > +        return 0;
> 
> Memory of 'cpuinfo' will be leaked. Should we go to cleanup?

Ouch. Of course I do need to avoid this. Will fix.

Thanks, 

-- 
Francesco Romani
RedHat Engineering Virtualization R & D
Phone: 8261328
IRC: fromani


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