From b02f87acc000ebdc3ef6dc242d39c0da1c2480b5 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Thu, 10 Jan 2013 23:01:33 -0800 Subject: [PATCH] Fixed glXCreateContext crash due to use of freed memory. --- src/renderer_gl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 336bf3609..1ff567ab5 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -449,12 +449,13 @@ namespace bgfx XMapRaised(display, window); XFlush(display); - XFree(visualInfo); BX_TRACE("Create GL 2.1 context."); m_context = glXCreateContext(display, visualInfo, 0, GL_TRUE); BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context."); + XFree(visualInfo); + typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*); glXCreateContextAttribsARBProc glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); if (NULL != glXCreateContextAttribsARB)