[libvirt PATCH 01/21] tests: Use glib memory functions in virpcimock.c

Tim Wiederhake twiederh at redhat.com
Fri Sep 11 11:41:58 UTC 2020


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 tests/virpcimock.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 92b6f810d8..6b1f2f2a5a 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -427,9 +427,7 @@ pci_device_create_iommu(const struct pciDevice *dev,
             return;
     }
 
-    if (VIR_ALLOC_QUIET(iommuGroup) < 0)
-        ABORT_OOM();
-
+    iommuGroup = g_new0(struct pciIommuGroup, 1);
     iommuGroup->iommu = dev->iommuGroup;
     iommuGroup->nDevicesBoundToVFIO = 0; /* No device bound to VFIO by default */
 
@@ -469,8 +467,7 @@ pci_device_new_from_stub(const struct pciDevice *data)
         c = strchr(c, ':');
     }
 
-    if (VIR_ALLOC_QUIET(dev) < 0)
-        ABORT_OOM();
+    dev = g_new0(struct pciDevice, 1);
 
     configSrc = g_strdup_printf("%s/virpcitestdata/%s.config", abs_srcdir, id);
 
@@ -694,8 +691,7 @@ pci_driver_new(const char *name, ...)
     int vendor, device;
     g_autofree char *driverpath = NULL;
 
-    if (VIR_ALLOC_QUIET(driver) < 0)
-        ABORT_OOM();
+    driver = g_new0(struct pciDriver, 1);
     driver->name = g_strdup(name);
     if (!(driverpath = pci_driver_get_path(driver, NULL, true)))
         ABORT_OOM();
-- 
2.26.2




More information about the libvir-list mailing list