summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2013-06-08 00:51:45 +0200
committerDavid Tardon <dtardon@redhat.com>2013-06-10 04:58:56 +0000
commita775188f6bbf3bbf8448b2b7398a1902908bb5e2 (patch)
treec189e36a66e1b39fb25d8b94368306596d8cb8f6 /slideshow
parent66558cc3783fd1645661043901a4eee371c95de9 (diff)
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/4195 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
index 3c12fee17ad4..65c992af600e 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
@@ -537,7 +537,13 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
for ( ; i < nfbconfigs; 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;
glXGetFBConfigAttrib (GLWin.dpy, fbconfigs[i], GLX_DRAWABLE_TYPE, &value);
@@ -565,11 +571,14 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
/* TODO: handle non Y inverted cases */
break;
}
+ if (vi != firstVisual)
+ XFree (vi);
if( i != nfbconfigs ) {
vi = glXGetVisualFromFBConfig( GLWin.dpy, fbconfigs[i] );
mbHasTFPVisual = true;
pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow );
+ XFree ( vi );
SAL_INFO("slideshow.opengl", "found visual suitable for texture_from_pixmap");
} else if( firstVisual && pAttributeTable[1] == NULL ) {
vi = firstVisual;
@@ -577,8 +586,10 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow );
SAL_INFO("slideshow.opengl", "did not find visual suitable for texture_from_pixmap, using " << vi->visualid);
}
+ XFree ( fbconfigs );
#else
pChildSysData = lcl_createSystemWindow( vi, pPWindow, &pWindow );
+ XFree ( vi );
#endif
if ( pChildSysData )
break;
@@ -586,6 +597,12 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
++pAttributeTable;
}
+
+#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap )
+ if ( firstVisual )
+ XFree (firstVisual);
+#endif
+
#endif
#if defined( _WIN32 )