Kaydet (Commit) a775188f authored tarafından Mark Wielaard's avatar Mark Wielaard Kaydeden (comit) David Tardon

Fix memory leak in OGLTransitionerImpl::createWindow.

XFree the result of glXChooseVisual, glXGetVisualFromFBConfig and
glXGetFBConfigs when done.

Change-Id: I145c7f5f083718d983ccea4b534d4e90056eb14e
Reviewed-on: https://gerrit.libreoffice.org/4195Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 66558cc3
...@@ -537,7 +537,13 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow ) ...@@ -537,7 +537,13 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
for ( ; i < nfbconfigs; i++) for ( ; i < nfbconfigs; i++)
{ {
visinfo = glXGetVisualFromFBConfig (GLWin.dpy, fbconfigs[i]); visinfo = glXGetVisualFromFBConfig (GLWin.dpy, fbconfigs[i]);
if( !visinfo || visinfo->visualid != vi->visualid ) if( !visinfo )
continue;
unx::VisualID visualid = visinfo->visualid;
XFree ( visinfo );
if ( visualid != vi->visualid )
continue; continue;
glXGetFBConfigAttrib (GLWin.dpy, fbconfigs[i], GLX_DRAWABLE_TYPE, &value); glXGetFBConfigAttrib (GLWin.dpy, fbconfigs[i], GLX_DRAWABLE_TYPE, &value);
...@@ -565,11 +571,14 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow ) ...@@ -565,11 +571,14 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
/* TODO: handle non Y inverted cases */ /* TODO: handle non Y inverted cases */
break; break;
} }
if (vi != firstVisual)
XFree (vi);
if( i != nfbconfigs ) { if( i != nfbconfigs ) {
vi = glXGetVisualFromFBConfig( GLWin.dpy, fbconfigs[i] ); vi = glXGetVisualFromFBConfig( GLWin.dpy, fbconfigs[i] );
mbHasTFPVisual = true; mbHasTFPVisual = true;
pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow ); pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow );
XFree ( vi );
SAL_INFO("slideshow.opengl", "found visual suitable for texture_from_pixmap"); SAL_INFO("slideshow.opengl", "found visual suitable for texture_from_pixmap");
} else if( firstVisual && pAttributeTable[1] == NULL ) { } else if( firstVisual && pAttributeTable[1] == NULL ) {
vi = firstVisual; vi = firstVisual;
...@@ -577,8 +586,10 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow ) ...@@ -577,8 +586,10 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow ); pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow );
SAL_INFO("slideshow.opengl", "did not find visual suitable for texture_from_pixmap, using " << vi->visualid); SAL_INFO("slideshow.opengl", "did not find visual suitable for texture_from_pixmap, using " << vi->visualid);
} }
XFree ( fbconfigs );
#else #else
pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow ); pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow );
XFree ( vi );
#endif #endif
if ( pChildSysData ) if ( pChildSysData )
break; break;
...@@ -586,6 +597,12 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow ) ...@@ -586,6 +597,12 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
++pAttributeTable; ++pAttributeTable;
} }
#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap )
if ( firstVisual )
XFree (firstVisual);
#endif
#endif #endif
#if defined( _WIN32 ) #if defined( _WIN32 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment