Wine-Bug: http://bugs.winehq.org/show_bug.cgi?id=58973
Looks like these strings aren't as static as glGetString says they are.
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: http://bugs.winehq.org/show_bug.cgi?id=58973 --- dlls/win32u/opengl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 60c80784115..4840d59f292 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -1115,10 +1115,18 @@ static void init_device_info( struct egl_platform *egl, const struct opengl_func
if (context) { + char *renderer, *vendor; + funcs->p_eglMakeCurrent( egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, context );
- egl->device_name = gpu_device_name( egl->vendor_id, egl->device_id, (const char *)funcs->p_glGetString( GL_RENDERER ) ); - egl->vendor_name = opengl_vendor_to_name( egl->vendor_id, (const char *)funcs->p_glGetString( GL_VENDOR ) ); + renderer = strdup( (const char *)funcs->p_glGetString( GL_RENDERER ) ); + egl->device_name = gpu_device_name( egl->vendor_id, egl->device_id, renderer ); + if (egl->device_name != renderer) free( renderer ); + + vendor = strdup( (const char *)funcs->p_glGetString( GL_VENDOR ) ); + egl->vendor_name = opengl_vendor_to_name( egl->vendor_id, vendor ); + if (egl->device_name != renderer) free( vendor ); + TRACE( " - device_name: %s\n", debugstr_a( egl->device_name ) ); TRACE( " - vendor_name: %s\n", debugstr_a( egl->vendor_name ) );
Alfred Agrell (@Alcaro) commented about dlls/win32u/opengl.c:
if (context) {
char *renderer, *vendor;funcs->p_eglMakeCurrent( egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, context );
egl->device_name = gpu_device_name( egl->vendor_id, egl->device_id, (const char *)funcs->p_glGetString( GL_RENDERER ) );egl->vendor_name = opengl_vendor_to_name( egl->vendor_id, (const char *)funcs->p_glGetString( GL_VENDOR ) );
renderer = strdup( (const char *)funcs->p_glGetString( GL_RENDERER ) );egl->device_name = gpu_device_name( egl->vendor_id, egl->device_id, renderer );if (egl->device_name != renderer) free( renderer );vendor = strdup( (const char *)funcs->p_glGetString( GL_VENDOR ) );egl->vendor_name = opengl_vendor_to_name( egl->vendor_id, vendor );if (egl->device_name != renderer) free( vendor );
Is this supposed to compare to renderer? Shouldn't it be vendor?
Feels like a memory leak even with that fixed, but if the function is named init, that's probably once per process and not worth worrying about.
On Mon Nov 17 09:11:42 2025 +0000, Alfred Agrell wrote:
Is this supposed to compare to renderer? Shouldn't it be vendor? Feels like a memory leak even with that fixed, but if the function is named init, that's probably once per process and not worth worrying about.
Oh thanks for catching that, and yes the device objects live until the process exit.