From 5cb497146091acf84f389f6b459f5d2f8ea86643 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 18 Jun 2019 18:57:17 +0200 Subject: mi/miinitext.c: fix memleaks: remove (double) glx initialization Fix these memory leaks: ==30021== 128 bytes in 1 blocks are definitely lost in loss record 230 of 302 ==30021== at 0x483577F: malloc (vg_replace_malloc.c:299) ==30021== by 0x2EF89C: init_visuals (xf86glx.c:390) ==30021== by 0x2EF89C: __MESA_initVisuals (xf86glx.c:541) ==30021== by 0x17C922: GlxInitVisuals (glxext.c:317) ==30021== by 0x218E73: fbInitVisuals (fbcmap.c:668) ==30021== by 0x20BEB1: fbFinishScreenInit (fbscreen.c:229) ==30021== by 0x20C275: fbScreenInit (fbscreen.c:273) ==30021== by 0x1E0317: nxagentOpenScreen (Screen.c:1357) ==30021== by 0x16D848: AddScreen (dispatch.c:4171) ==30021== by 0x1DB7FF: InitOutput (Init.c:396) ==30021== by 0x14DB12: main (main.c:279) ==30021== ==30021== 3,072 (192 direct, 2,880 indirect) bytes in 1 blocks are definitely lost in loss record 290 of 302 ==30021== at 0x483577F: malloc (vg_replace_malloc.c:299) ==30021== by 0x2CCCC7: _gl_context_modes_create (glcontextmodes.c:364) ==30021== by 0x2EF87C: init_visuals (xf86glx.c:381) ==30021== by 0x2EF87C: __MESA_initVisuals (xf86glx.c:541) ==30021== by 0x17C922: GlxInitVisuals (glxext.c:317) ==30021== by 0x218E73: fbInitVisuals (fbcmap.c:668) ==30021== by 0x20BEB1: fbFinishScreenInit (fbscreen.c:229) ==30021== by 0x20C275: fbScreenInit (fbscreen.c:273) ==30021== by 0x1E0317: nxagentOpenScreen (Screen.c:1357) ==30021== by 0x16D848: AddScreen (dispatch.c:4171) ==30021== by 0x1DB7FF: InitOutput (Init.c:396) ==30021== by 0x14DB12: main (main.c:279) The problem here is that GlxInitVisuals is called twice. First via fbScreenInit and then again via nxagentInitGlxExtension. We remove the first one to ensure the code in nxagenOpenScreen works as initially intended. There's an xorg upstream patch that does the same (7d74690536b64f7b8e8036507ab7790807349c50), but it also cleans up other stuff we do not even have in out source (yet?). --- nx-X11/programs/Xserver/mi/miinitext.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/mi/miinitext.c b/nx-X11/programs/Xserver/mi/miinitext.c index 9e0f82643..319cb1f2d 100644 --- a/nx-X11/programs/Xserver/mi/miinitext.c +++ b/nx-X11/programs/Xserver/mi/miinitext.c @@ -228,7 +228,6 @@ extern void GlxPushProvider(__GLXprovider *impl); */ #ifndef __DARWIN__ extern void GlxExtensionInit(void); -extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); #else extern void DarwinGlxExtensionInit(void); extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *); @@ -474,9 +473,7 @@ InitVisualWrap() { miResetInitVisuals(); #ifdef GLXEXT -#ifndef __DARWIN__ - GlxWrapInitVisuals(&miInitVisualsProc); -#else +#ifdef __DARWIN__ DarwinGlxWrapInitVisuals(&miInitVisualsProc); #endif #endif -- cgit v1.2.3