mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
resctrl: Add virResctrlInfoPerTypeFree
It will be easier to add more dynamic data later on. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7c40f1ead9
commit
4437a775dc
@ -197,6 +197,17 @@ virResctrlInfoMemBWFree(virResctrlInfoMemBW *ptr)
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virResctrlInfoMemBW, virResctrlInfoMemBWFree);
|
||||
|
||||
static void
|
||||
virResctrlInfoPerTypeFree(virResctrlInfoPerType *ptr)
|
||||
{
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
g_free(ptr);
|
||||
}
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virResctrlInfoPerType, virResctrlInfoPerTypeFree);
|
||||
|
||||
|
||||
static void
|
||||
virResctrlInfoDispose(void *obj)
|
||||
@ -214,7 +225,7 @@ virResctrlInfoDispose(void *obj)
|
||||
|
||||
if (level->types) {
|
||||
for (j = 0; j < VIR_CACHE_TYPE_LAST; j++)
|
||||
g_free(level->types[j]);
|
||||
virResctrlInfoPerTypeFree(level->types[j]);
|
||||
}
|
||||
g_free(level->types);
|
||||
g_free(level);
|
||||
@ -539,7 +550,7 @@ virResctrlGetCacheInfo(virResctrlInfo *resctrl,
|
||||
int type = 0;
|
||||
unsigned int level = 0;
|
||||
virResctrlInfoPerLevel *i_level = NULL;
|
||||
g_autofree virResctrlInfoPerType *i_type = NULL;
|
||||
g_autoptr(virResctrlInfoPerType) i_type = NULL;
|
||||
|
||||
VIR_DEBUG("Parsing info type '%s'", ent->d_name);
|
||||
if (ent->d_name[0] != 'L')
|
||||
|
Loading…
Reference in New Issue
Block a user