DDRAW: don't leak visuals

Saulius Krasuckas saulius2 at ar.fi.lt
Sun Aug 21 15:26:33 CDT 2005


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;



More information about the wine-devel mailing list