priv->dri2Display;
struct dri2_screen *psc;
__GLXDRIscreen *psp;
+ struct glx_config *configs = NULL, *visuals = NULL;
char *driverName, *deviceName;
drm_magic_t magic;
int i;
extensions = psc->core->getExtensions(psc->driScreen);
dri2BindExtensions(psc, extensions);
- psc->base.configs =
- driConvertConfigs(psc->core, psc->base.configs, driver_configs);
- psc->base.visuals =
- driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
+ configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
+ visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
+
+ if (!configs || !visuals)
+ goto handle_error;
+
+ glx_config_destroy_list(psc->base.configs);
+ psc->base.configs = configs;
+ glx_config_destroy_list(psc->base.visuals);
+ psc->base.visuals = visuals;
psc->driver_configs = driver_configs;
return &psc->base;
handle_error:
+ if (configs)
+ glx_config_destroy_list(configs);
+ if (visuals)
+ glx_config_destroy_list(visuals);
+ if (psc->driScreen)
+ psc->core->destroyScreen(psc->driScreen);
+ psc->driScreen = NULL;
if (psc->fd >= 0)
close(psc->fd);
if (psc->driver)
dlclose(psc->driver);
+
Xfree(driverName);
Xfree(deviceName);
glx_screen_cleanup(&psc->base);
tail = tail->next;
}
- glx_config_destroy_list(configs);
-
return head.next;
}
drm_handle_t hFB;
int junk;
const __DRIconfig **driver_configs;
- struct glx_config *visual;
+ struct glx_config *visual, *configs = NULL, *visuals = NULL;
/* DRI protocol version. */
dri_version.major = driDpy->driMajor;
goto handle_error;
}
- psc->base.configs =
- driConvertConfigs(psc->core, psc->base.configs, driver_configs);
- psc->base.visuals =
- driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
+ configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
+ visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
+
+ if (!configs || !visuals)
+ goto handle_error;
+
+ glx_config_destroy_list(psc->base.configs);
+ psc->base.configs = configs;
+ glx_config_destroy_list(psc->base.visuals);
+ psc->base.visuals = visuals;
psc->driver_configs = driver_configs;
return psp;
handle_error:
+ if (configs)
+ glx_config_destroy_list(configs);
+ if (visuals)
+ glx_config_destroy_list(visuals);
+
if (pSAREA != MAP_FAILED)
drmUnmap(pSAREA, SAREA_MAX);
const __DRIconfig **driver_configs;
const __DRIextension **extensions;
struct drisw_screen *psc;
+ struct glx_config *configs = NULL, *visuals = NULL;
int i;
psc = Xcalloc(1, sizeof *psc);
extensions = psc->core->getExtensions(psc->driScreen);
driswBindExtensions(psc, extensions);
- psc->base.configs =
- driConvertConfigs(psc->core, psc->base.configs, driver_configs);
- psc->base.visuals =
- driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
+ configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
+ visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
+
+ if (!configs || !visuals)
+ goto handle_error;
+
+ glx_config_destroy_list(psc->base.configs);
+ psc->base.configs = configs;
+ glx_config_destroy_list(psc->base.visuals);
+ psc->base.visuals = visuals;
psc->driver_configs = driver_configs;
return &psc->base;
handle_error:
+ if (configs)
+ glx_config_destroy_list(configs);
+ if (visuals)
+ glx_config_destroy_list(visuals);
+ if (psc->driScreen)
+ psc->core->destroyScreen(psc->driScreen);
+ psc->driScreen = NULL;
+
if (psc->driver)
dlclose(psc->driver);
glx_screen_cleanup(&psc->base);