[libvirt PATCH 1/4] tests: virNumaGetPages: use g_new0 instead of VIR_ALLOC_N

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

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 tests/virnumamock.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/tests/virnumamock.c b/tests/virnumamock.c
index e6282c7f33..40e18e646e 100644
--- a/tests/virnumamock.c
+++ b/tests/virnumamock.c
@@ -133,23 +133,13 @@ virNumaGetPages(int node,
     size_t i = 0;
 
     if (pages_size)
-        *pages_size = NULL;
+        *pages_size = g_new0(unsigned int, npages_def);
 
     if (pages_avail)
-        *pages_avail = NULL;
+        *pages_avail = g_new0(unsigned long long, npages_def);
 
     if (pages_free)
-        *pages_free = NULL;
-
-    *npages = 0;
-
-    if ((pages_size && VIR_ALLOC_N(*pages_size, npages_def) < 0) ||
-        (pages_avail && VIR_ALLOC_N(*pages_avail, npages_def) < 0) ||
-        (pages_free && VIR_ALLOC_N(*pages_free, npages_def) < 0)) {
-        VIR_FREE(*pages_size);
-        VIR_FREE(*pages_avail);
-        return -1;
-    }
+        *pages_free = g_new0(unsigned long long, npages_def);
 
     *npages = npages_def;
     if (pages_size)
-- 
2.26.2




[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