I was walking through a Lionel code (written in 2003) and stumbled at the call to XGetVisualInfo(). The list of visuals it returns is never released. Hence, three lines were added.
This is my first X-perience. Does this look OK, folks?
Index: dlls/ddraw/device_opengl.c =================================================================== RCS file: /home/wine/wine/dlls/ddraw/device_opengl.c,v retrieving revision 1.7 diff -p -u -r1.7 device_opengl.c --- dlls/ddraw/device_opengl.c 11 Aug 2005 10:57:47 -0000 1.7 +++ dlls/ddraw/device_opengl.c 21 Aug 2005 19:58:09 -0000 @@ -4344,12 +4344,14 @@ d3ddevice_init_at_startup(void *gl_handl gl_context = glXCreateContext(display, vis, NULL, GL_TRUE);
if (gl_context == NULL) { + XFree(vis); LEAVE_GL(); WARN("Error creating default context for capabilities initialization - D3D support disabled !\n"); return FALSE; } if (glXMakeCurrent(display, drawable, gl_context) == False) { glXDestroyContext(display, gl_context); + XFree(vis); LEAVE_GL(); WARN("Error setting default context as current for capabilities initialization - D3D support disabled !\n"); return FALSE; @@ -4435,6 +4437,7 @@ d3ddevice_init_at_startup(void *gl_handl /* And frees this now-useless context */ glXMakeCurrent(display, None, NULL); glXDestroyContext(display, gl_context); + XFree(vis); LEAVE_GL();
return TRUE;
* On Sun, 21 Aug 2005, Saulius Krasuckas wrote:
This is my first X-perience. Does this look OK, folks?
Proabably I should post a diff with a larger context to get an answer. Sorry.
Index: dlls/ddraw/device_opengl.c =================================================================== RCS file: /home/wine/wine/dlls/ddraw/device_opengl.c,v retrieving revision 1.7 diff -p -u -1 -0 -r1.7 device_opengl.c --- dlls/ddraw/device_opengl.c 11 Aug 2005 10:57:47 -0000 1.7 +++ dlls/ddraw/device_opengl.c 21 Aug 2005 20:34:03 -0000 @@ -4337,26 +4337,28 @@ d3ddevice_init_at_startup(void *gl_handl template.visualid = XVisualIDFromVisual(visual); vis = XGetVisualInfo(display, VisualIDMask, &template, &num); if (vis == NULL) { LEAVE_GL(); WARN("Error creating visual info for capabilities initialization - D3D support disabled !\n"); return FALSE; } gl_context = glXCreateContext(display, vis, NULL, GL_TRUE);
if (gl_context == NULL) { + XFree(vis); LEAVE_GL(); WARN("Error creating default context for capabilities initialization - D3D support disabled !\n"); return FALSE; } if (glXMakeCurrent(display, drawable, gl_context) == False) { glXDestroyContext(display, gl_context); + XFree(vis); LEAVE_GL(); WARN("Error setting default context as current for capabilities initialization - D3D support disabled !\n"); return FALSE; }
/* Then, query all extensions */ glXExtensions = glXQueryExtensionsString(display, DefaultScreen(display)); /* Note: not used right now but will for PBuffers */ glExtensions = (const char *) glGetString(GL_EXTENSIONS); glVersion = (const char *) glGetString(GL_VERSION); if (gl_handle != NULL) { @@ -4428,14 +4430,15 @@ d3ddevice_init_at_startup(void *gl_handl GL_extensions.glCompressedTexSubImage2D = pglXGetProcAddressARB( (const GLubyte *) "glCompressedTexSubImage2DARB"); } }
/* Fill the D3D capabilities according to what GL tells us... */ fill_caps();
/* And frees this now-useless context */ glXMakeCurrent(display, None, NULL); glXDestroyContext(display, gl_context); + XFree(vis); LEAVE_GL();
return TRUE; }