glx: fix possible memory leaks in dri2CreateScreen()
Original patch fixed up by Brian Paul.
This commit is contained in:
parent
4886f677ec
commit
81cca6d453
|
@ -504,8 +504,10 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
|
||||||
psc->ext_list_first_time = GL_TRUE;
|
psc->ext_list_first_time = GL_TRUE;
|
||||||
|
|
||||||
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
|
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
|
||||||
&driverName, &deviceName))
|
&driverName, &deviceName)) {
|
||||||
|
XFree(psp);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
psc->driver = driOpenDriver(driverName);
|
psc->driver = driOpenDriver(driverName);
|
||||||
if (psc->driver == NULL) {
|
if (psc->driver == NULL) {
|
||||||
|
@ -534,17 +536,17 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
|
||||||
psc->fd = open(deviceName, O_RDWR);
|
psc->fd = open(deviceName, O_RDWR);
|
||||||
if (psc->fd < 0) {
|
if (psc->fd < 0) {
|
||||||
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
||||||
return NULL;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drmGetMagic(psc->fd, &magic)) {
|
if (drmGetMagic(psc->fd, &magic)) {
|
||||||
ErrorMessageF("failed to get magic\n");
|
ErrorMessageF("failed to get magic\n");
|
||||||
return NULL;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
|
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
|
||||||
ErrorMessageF("failed to authenticate magic %d\n", magic);
|
ErrorMessageF("failed to authenticate magic %d\n", magic);
|
||||||
return NULL;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the server does not support the protocol for
|
/* If the server does not support the protocol for
|
||||||
|
@ -558,7 +560,7 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
|
||||||
|
|
||||||
if (psc->__driScreen == NULL) {
|
if (psc->__driScreen == NULL) {
|
||||||
ErrorMessageF("failed to create dri screen\n");
|
ErrorMessageF("failed to create dri screen\n");
|
||||||
return NULL;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
driBindCommonExtensions(psc);
|
driBindCommonExtensions(psc);
|
||||||
|
@ -602,6 +604,7 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
|
||||||
handle_error:
|
handle_error:
|
||||||
Xfree(driverName);
|
Xfree(driverName);
|
||||||
Xfree(deviceName);
|
Xfree(deviceName);
|
||||||
|
XFree(psp);
|
||||||
|
|
||||||
/* FIXME: clean up here */
|
/* FIXME: clean up here */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue