diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-09-28 00:47:53 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-09-28 00:47:53 +0200 |
commit | dd88123ad16ce27690a2aac94127175ed5213c64 (patch) | |
tree | c75809934a96765be1e1f7e8fdc10e8d65c16e71 /src | |
parent | 5cef3b469eb2ffa8e7b9f8758079b6fa414237e5 (diff) |
Dont use free'd fbconfigs
Diffstat (limited to 'src')
-rw-r--r-- | src/mgl.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -36,13 +36,14 @@ static int glx_context_init() { None }; + context.fbconfigs = NULL; context.visual_info = NULL; context.fbconfig = NULL; int numfbconfigs = 0; - GLXFBConfig *fbconfigs = context.gl.glXChooseFBConfig(context.connection, DefaultScreen(context.connection), attr, &numfbconfigs); + context.fbconfigs = context.gl.glXChooseFBConfig(context.connection, DefaultScreen(context.connection), attr, &numfbconfigs); for(int i = 0; i < numfbconfigs; i++) { - context.visual_info = context.gl.glXGetVisualFromFBConfig(context.connection, fbconfigs[i]); + context.visual_info = context.gl.glXGetVisualFromFBConfig(context.connection, context.fbconfigs[i]); if(!context.visual_info) continue; @@ -53,7 +54,7 @@ static int glx_context_init() { continue; } - context.fbconfig = fbconfigs[i]; + context.fbconfig = context.fbconfigs[i]; if(pict_format->direct.alphaMask > 0) break; @@ -62,9 +63,6 @@ static int glx_context_init() { context.fbconfig = NULL; } - if(fbconfigs) - XFree(fbconfigs); - if(!context.visual_info) { fprintf(stderr, "mgl error: no appropriate visual found\n"); return -1; @@ -78,6 +76,11 @@ static void glx_context_deinit() { XFree(context.visual_info); context.visual_info = NULL; } + + if(context.fbconfigs) { + XFree(context.fbconfigs); + context.fbconfigs = NULL; + } } int mgl_init(void) { |