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

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

 



> > +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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]