[PATCH 05/10] resctrl: Add virResctrlInfoMemBWFree

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

 



It will be easier to add more dynamic data later on

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/util/virresctrl.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 000191c5d431..daa344ec989b 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -186,6 +186,17 @@ struct _virResctrlInfo {
     virResctrlInfoMongrp *monitor_info;
 };
 
+static void
+virResctrlInfoMemBWFree(virResctrlInfoMemBW *ptr)
+{
+    if (!ptr)
+        return;
+
+    g_free(ptr);
+}
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virResctrlInfoMemBW, virResctrlInfoMemBWFree);
+
 
 static void
 virResctrlInfoDispose(void *obj)
@@ -212,7 +223,8 @@ virResctrlInfoDispose(void *obj)
     if (resctrl->monitor_info)
         g_strfreev(resctrl->monitor_info->features);
 
-    g_free(resctrl->membw_info);
+    virResctrlInfoMemBWFree(resctrl->membw_info);
+
     g_free(resctrl->levels);
     g_free(resctrl->monitor_info);
 }
@@ -628,7 +640,7 @@ static int
 virResctrlGetMemoryBandwidthInfo(virResctrlInfo *resctrl)
 {
     int rv = -1;
-    g_autofree virResctrlInfoMemBW *i_membw = NULL;
+    g_autoptr(virResctrlInfoMemBW) i_membw = NULL;
 
     /* query memory bandwidth allocation info */
     i_membw = g_new0(virResctrlInfoMemBW, 1);
-- 
2.46.0




[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]

  Powered by Linux