diff --git a/freeglut/freeglut/ChangeLog b/freeglut/freeglut/ChangeLog index 73d94f6..e4cdea1 100644 --- a/freeglut/freeglut/ChangeLog +++ b/freeglut/freeglut/ChangeLog @@ -1096,3 +1096,6 @@ fixes bug #961938 (Executable bit set on non exe files). (284) Handle modifiers in MotionNotify events, too. This fixes bug #1227920 (glutGetModifiers not set/allowed in mouse callbacks). In addition, some related cleanup has been done. + +(285) X11 only: Free XVisualInfo structures when they are not needed +anymore, fixing a space leak. Not perfect for menus yet... diff --git a/freeglut/freeglut/src/freeglut_state.c b/freeglut/freeglut/src/freeglut_state.c index ff375b9..93a3f1b 100644 --- a/freeglut/freeglut/src/freeglut_state.c +++ b/freeglut/freeglut/src/freeglut_state.c @@ -260,7 +260,15 @@ int FGAPIENTRY glutGet( GLenum eWhat ) /* I do not know yet if there will be a fgChooseVisual() function for Win32 */ case GLUT_DISPLAY_MODE_POSSIBLE: - return( fgChooseVisual() == NULL ? 0 : 1 ); + { + XVisualInfo* visualInfo = fgChooseVisual(); + if ( visualInfo == NULL ) { + return 0; + } else { + XFree( visualInfo ); + return 1; + } + } /* This is system-dependant */ case GLUT_WINDOW_FORMAT_ID: diff --git a/freeglut/freeglut/src/freeglut_window.c b/freeglut/freeglut/src/freeglut_window.c index d424969..a469866 100644 --- a/freeglut/freeglut/src/freeglut_window.c +++ b/freeglut/freeglut/src/freeglut_window.c @@ -618,6 +618,7 @@ void fgCloseWindow( SFG_Window* window ) #if TARGET_HOST_UNIX_X11 glXDestroyContext( fgDisplay.Display, window->Window.Context ); + XFree( window->Window.VisualInfo ); XDestroyWindow( fgDisplay.Display, window->Window.Handle ); XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */