mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Free visualinfo and picture format info structures
Fixes a memory leak.
This commit is contained in:
parent
e9693a13fe
commit
19c2a53dc0
@ -80,6 +80,8 @@ static GLFWbool chooseFBConfig(
|
|||||||
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
usableCount = 0;
|
usableCount = 0;
|
||||||
|
|
||||||
|
XVisualInfo *visualinfo = NULL;
|
||||||
|
XRenderPictFormat *pictFormat = NULL;
|
||||||
selectionloop:
|
selectionloop:
|
||||||
for (i = 0; i < nativeCount; i++)
|
for (i = 0; i < nativeCount; i++)
|
||||||
{
|
{
|
||||||
@ -98,13 +100,21 @@ selectionloop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( findTransparent ) {
|
if( findTransparent ) {
|
||||||
XVisualInfo *visualinfo;
|
|
||||||
XRenderPictFormat *pictFormat;
|
if( visualinfo ) {
|
||||||
|
XFree( visualinfo );
|
||||||
|
visualinfo = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
visualinfo = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
visualinfo = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
||||||
if (!visualinfo)
|
if (!visualinfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( pictFormat ) {
|
||||||
|
XFree( pictFormat );
|
||||||
|
pictFormat = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
pictFormat = XRenderFindVisualFormat(_glfw.x11.display, visualinfo->visual);
|
pictFormat = XRenderFindVisualFormat(_glfw.x11.display, visualinfo->visual);
|
||||||
if( !pictFormat )
|
if( !pictFormat )
|
||||||
continue;
|
continue;
|
||||||
@ -141,6 +151,15 @@ selectionloop:
|
|||||||
|
|
||||||
u->glx = n;
|
u->glx = n;
|
||||||
usableCount++;
|
usableCount++;
|
||||||
|
|
||||||
|
if( visualinfo ) {
|
||||||
|
XFree( visualinfo );
|
||||||
|
visualinfo = NULL;
|
||||||
|
}
|
||||||
|
if( pictFormat ) {
|
||||||
|
XFree( pictFormat );
|
||||||
|
pictFormat = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// reiterate the selection loop without looking for transparency supporting
|
// reiterate the selection loop without looking for transparency supporting
|
||||||
// formats if no matchig FB configs for a transparent window were found.
|
// formats if no matchig FB configs for a transparent window were found.
|
||||||
|
Loading…
Reference in New Issue
Block a user