]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Use glib memory functions in virpcimock.c
authorTim Wiederhake <twiederh@redhat.com>
Fri, 11 Sep 2020 11:41:58 +0000 (13:41 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 11 Sep 2020 16:19:58 +0000 (18:19 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
tests/virpcimock.c

index 92b6f810d888bd43c5adbe34e3e8034d23a98a16..6b1f2f2a5aaa957017424577834f551db2945309 100644 (file)
@@ -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();