Fixed glXCreateContext crash due to use of freed memory.

This commit is contained in:
bkaradzic 2013-01-10 23:01:33 -08:00
parent 81a712067d
commit b02f87acc0
1 changed files with 2 additions and 1 deletions

View File

@ -449,12 +449,13 @@ namespace bgfx
XMapRaised(display, window); XMapRaised(display, window);
XFlush(display); XFlush(display);
XFree(visualInfo);
BX_TRACE("Create GL 2.1 context."); BX_TRACE("Create GL 2.1 context.");
m_context = glXCreateContext(display, visualInfo, 0, GL_TRUE); m_context = glXCreateContext(display, visualInfo, 0, GL_TRUE);
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context."); 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*); typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); glXCreateContextAttribsARBProc glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
if (NULL != glXCreateContextAttribsARB) if (NULL != glXCreateContextAttribsARB)