hw/vfio/platform: replace g_malloc0_n by g_new0
authorEric Auger <eric.auger@linaro.org>
Thu, 11 Jun 2015 08:44:40 +0000 (09:44 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 11 Jun 2015 13:22:57 +0000 (14:22 +0100)
g_malloc0_n() is introduced since glib-2.24 while QEMU currently
requires glib-2.22. This may cause a link error on some distributions.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/vfio/platform.c

index 35266a813c9caec2343523a49f7104691f60619e..9382bb7f361c975ebc312f1f38a1f9f8883836e3 100644 (file)
@@ -346,8 +346,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
         return ret;
     }
 
-    vdev->regions = g_malloc0_n(vbasedev->num_regions,
-                                sizeof(VFIORegion *));
+    vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions);
 
     for (i = 0; i < vbasedev->num_regions; i++) {
         struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };