From da898fca026f629be0ed234f0a89a99bc662385d Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Wed, 25 Jan 2023 07:49:29 +0100 Subject: [PATCH] Free the GLX framebuffer configurations Adds missing XFree for a glXChooseFBConfig Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I4c30341f90666170dac5d90b0c65d1deff4e0818 Reviewed-by: Laszlo Agocs --- .../xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index 103bb1e22b..04eac027cd 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -395,14 +395,19 @@ QGLXContext::QGLXContext(Display *display, GLXContext context, void *visualInfo, int numConfigs = 0; static const int attribs[] = { GLX_FBCONFIG_ID, configId, None }; configs = glXChooseFBConfig(m_display, screenNumber, attribs, &numConfigs); - if (!configs || numConfigs < 1) { + if (!configs) { + qWarning("QGLXContext: Failed to find config(invalid arguments for glXChooseFBConfig)"); + return; + } else if (numConfigs < 1) { qWarning("QGLXContext: Failed to find config"); + XFree(configs); return; } if (configs && numConfigs > 1) // this is suspicious so warn but let it continue qWarning("QGLXContext: Multiple configs for FBConfig ID %d", configId); m_config = configs[0]; + XFree(configs); } Q_ASSERT(vinfo || m_config);