• Ulrich Sibiller's avatar
    mi/miinitext.c: fix memleaks: remove (double) glx initialization · 5cb49714
    Ulrich Sibiller authored
    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?).
    5cb49714
miinitext.c 11.3 KB