DRI2: Use single error path in initialization

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
This commit is contained in:
Pauli Nieminen 2010-04-21 11:07:47 +03:00 committed by Tiago Vignatti
parent 6eef70dc56
commit f0ab726d89

View File

@ -1066,18 +1066,14 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
/* Driver too old: use the old-style driverName field */
ds->numDrivers = 1;
ds->driverNames = malloc(sizeof(*ds->driverNames));
if (!ds->driverNames) {
free(ds);
return FALSE;
}
if (!ds->driverNames)
goto err_out;
ds->driverNames[0] = info->driverName;
} else {
ds->numDrivers = info->numDrivers;
ds->driverNames = malloc(info->numDrivers * sizeof(*ds->driverNames));
if (!ds->driverNames) {
free(ds);
return FALSE;
}
if (!ds->driverNames)
goto err_out;
memcpy(ds->driverNames, info->driverNames,
info->numDrivers * sizeof(*ds->driverNames));
}