From b59f00dacfe898a872927f86bfbd828d51fa3fd4 Mon Sep 17 00:00:00 2001 From: mittorn Date: Fri, 13 Oct 2023 01:40:33 +0300 Subject: [PATCH] ref_gl: init r_temppool before InitExtensions, fix extension string allocation --- ref/gl/gl_opengl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ref/gl/gl_opengl.c b/ref/gl/gl_opengl.c index 9e6d2160..0d6248a7 100644 --- a/ref/gl/gl_opengl.c +++ b/ref/gl/gl_opengl.c @@ -984,7 +984,7 @@ void GL_InitExtensions( void ) char *str; for(i = 0; i < n; i++) len += Q_strlen((const char*)pglGetStringi(GL_EXTENSIONS, i)) + 1; - str = (char*)Mem_Calloc( 1, len ); + str = (char*)Mem_Calloc( r_temppool, len ); glConfig.extensions_string = str; for(i = 0; i < n; i++) { @@ -1163,6 +1163,8 @@ qboolean R_Init( void ) GL_SetDefaultState(); + r_temppool = Mem_AllocPool( "Render Zone" ); + // create the window and set up the context if( !gEngfuncs.R_Init_Video( REF_GL )) // request GL context { @@ -1170,11 +1172,10 @@ qboolean R_Init( void ) gEngfuncs.R_Free_Video(); // Why? Host_Error again??? // gEngfuncs.Host_Error( "Can't initialize video subsystem\nProbably driver was not installed" ); + Mem_FreePool( &r_temppool ); return false; } - r_temppool = Mem_AllocPool( "Render Zone" ); - GL_SetDefaults(); R_CheckVBO(); R_InitImages();