diff options
Diffstat (limited to 'xorg-server/hw/xfree86/dri2/dri2.c')
-rw-r--r-- | xorg-server/hw/xfree86/dri2/dri2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c index 0c038b3d1..60ea6dd93 100644 --- a/xorg-server/hw/xfree86/dri2/dri2.c +++ b/xorg-server/hw/xfree86/dri2/dri2.c @@ -1577,7 +1577,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) if (info->version == 3 || info->numDrivers == 0) { /* Driver too old: use the old-style driverName field */ ds->numDrivers = info->driverName ? 1 : 2; - ds->driverNames = malloc(ds->numDrivers * sizeof(*ds->driverNames)); + ds->driverNames = xallocarray(ds->numDrivers, sizeof(*ds->driverNames)); if (!ds->driverNames) goto err_out; @@ -1591,7 +1591,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) } else { ds->numDrivers = info->numDrivers; - ds->driverNames = malloc(info->numDrivers * sizeof(*ds->driverNames)); + ds->driverNames = xallocarray(info->numDrivers, sizeof(*ds->driverNames)); if (!ds->driverNames) goto err_out; memcpy(ds->driverNames, info->driverNames, |