Hello,
the function dri2CreateScreen() at src/glx/x11/dri2_glx.c (from
MesaLib package 7.6.1 and 7.7 at least) has memory leak.
It returns without free the __GLXDRIscreen *psp variable on errors.
A less intrusive modification is below. Maybe it would be better if
the drivername and devicename had been free as soon as they become
useless.
*** dri2_glx.c 2010-01-25 10:28:35.000000000 -0200
--- dri2_glx-modified.c 2010-01-25 10:33:21.000000000 -0200
***************
*** 438,444 ****
--- 438,447 ----
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
&driverName, &deviceName))
+ {
+ XFree(psp):
return NULL;
+ }
psc->driver = driOpenDriver(driverName);
if (psc->driver == NULL) {
***************
*** 467,483 ****
psc->fd = open(deviceName, O_RDWR);
if (psc->fd < 0) {
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
! return NULL;
}
if (drmGetMagic(psc->fd, &magic)) {
ErrorMessageF("failed to get magic\n");
! return NULL;
}
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
ErrorMessageF("failed to authenticate magic %d\n", magic);
! return NULL;
}
/* If the server does not support the protocol for
--- 470,486 ----
psc->fd = open(deviceName, O_RDWR);
if (psc->fd < 0) {
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
! goto handle_error;
}
if (drmGetMagic(psc->fd, &magic)) {
ErrorMessageF("failed to get magic\n");
! goto handle_error;
}
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
ErrorMessageF("failed to authenticate magic %d\n", magic);
! goto handle_error;
}
/* If the server does not support the protocol for
***************
*** 491,497 ****
if (psc->__driScreen == NULL) {
ErrorMessageF("failed to create dri screen\n");
! return NULL;
}
driBindExtensions(psc, 1);
--- 494,500 ----
if (psc->__driScreen == NULL) {
ErrorMessageF("failed to create dri screen\n");
! goto handle_error;
}
driBindExtensions(psc, 1);
***************
*** 521,526 ****
--- 524,532 ----
handle_error:
Xfree(driverName);
Xfree(deviceName);
+
+ XFree(psp):
+
/* FIXME: clean up here */
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev