On 01/31/2018 08:36 AM, Martin Kletzander wrote: > Introduce virResctrlAllocCopyMasks() and use that to initially copy the default > group schemata to the allocation before reserving any parts of the cache. The > reason for this is that when new group is created the schemata will have unknown > data in it. If there was previously group with the same CLoS ID, it will have > the previous valies, if not it will have all bits set. And we need to set all > unspecified (in the XML) allocations to the same one as the default group. > > Some non-Linux functions now need to be made public due to this change. > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1289368 > > Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> > --- > src/util/virresctrl.c | 72 +++++++++++++++++++++++++++++++++++---------------- > 1 file changed, 50 insertions(+), 22 deletions(-) > [...] Coverity was fairly grumpy this morning... > @@ -1430,11 +1449,19 @@ virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl, > int ret = -1; > unsigned int level = 0; > virResctrlAllocPtr alloc_free = NULL; > + virResctrlAllocPtr alloc_default = NULL; > > alloc_free = virResctrlAllocGetUnused(resctrl); > if (!alloc_free) > return -1; > > + alloc_default = virResctrlAllocGetDefault(resctrl); > + if (!alloc_default) > + return -1; So does this leak alloc_free possibly? > + > + if (virResctrlAllocCopyMasks(alloc, alloc_default) < 0) > + return -1; > + and does this leak both alloc_free and alloc_default possibly? John > for (level = 0; level < alloc->nlevels; level++) { > virResctrlAllocPerLevelPtr a_level = alloc->levels[level]; > virResctrlAllocPerLevelPtr f_level = NULL; > @@ -1482,6 +1509,7 @@ virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl, > ret = 0; > cleanup: > virObjectUnref(alloc_free); > + virObjectUnref(alloc_default); > return ret; > } > > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list