psc->ext_list_first_time = GL_TRUE;
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
- &driverName, &deviceName))
+ &driverName, &deviceName)) {
+ XFree(psp);
return NULL;
+ }
psc->driver = driOpenDriver(driverName);
if (psc->driver == NULL) {
psc->fd = open(deviceName, O_RDWR);
if (psc->fd < 0) {
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
- return NULL;
+ goto handle_error;
}
if (drmGetMagic(psc->fd, &magic)) {
ErrorMessageF("failed to get magic\n");
- return NULL;
+ goto handle_error;
}
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
ErrorMessageF("failed to authenticate magic %d\n", magic);
- return NULL;
+ goto handle_error;
}
/* If the server does not support the protocol for
if (psc->__driScreen == NULL) {
ErrorMessageF("failed to create dri screen\n");
- return NULL;
+ goto handle_error;
}
driBindCommonExtensions(psc);
handle_error:
Xfree(driverName);
Xfree(deviceName);
+ XFree(psp);
/* FIXME: clean up here */