[PATCH] Fix memory leak in OGLTransitionerImpl::createWindow.

Mark Wielaard (via Code Review) gerrit at gerrit.libreoffice.org
Fri Jun 7 15:54:24 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4195

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/95/4195/1

Fix memory leak in OGLTransitionerImpl::createWindow.

XFree the result of glXGetVisualFromFBConfig and glXGetFBConfigs when done.

Change-Id: I145c7f5f083718d983ccea4b534d4e90056eb14e
---
M slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
1 file changed, 8 insertions(+), 1 deletion(-)



diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
index 3c12fee..aa91779 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
@@ -537,7 +537,13 @@
             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);
@@ -577,6 +583,7 @@
                 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 );
 #endif

-- 
To view, visit https://gerrit.libreoffice.org/4195
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I145c7f5f083718d983ccea4b534d4e90056eb14e
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Mark Wielaard <mark at klomp.org>



More information about the LibreOffice mailing list