Commit db1b7341 authored by Andrii Simiklit's avatar Andrii Simiklit Committed by Dylan Baker

mesa/st: fix a memory leak in get_version

This patch prevents memory leak in get_version function in st_manager.c
This issue was found by valgrind:
16 bytes in 1 blocks are definitely lost in loss record 6 of 1,418
   at 0x483CD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/
   by 0x63D9476: st_init_extensions (st_extensions.c:1679)
   by 0x63B803B: get_version (st_manager.c:1271)
   by 0x63B8124: st_api_query_versions (st_manager.c:1289)
   by 0x63266EF: dri_init_screen_helper (dri_screen.c:583)
   by 0x6321B12: dri2_init_screen (dri2.c:2110)
   by 0x631AACC: driCreateNewScreen2 (dri_util.c:155)
   by 0x5D58192: dri3_create_screen (dri3_glx.c:897)
   by 0x5D39829: AllocAndFetchScreenConfigs (glxext.c:815)
   by 0x5D39C57: __glXInitialize (glxext.c:941)
   by 0x5D3290A: GetGLXPrivScreenConfig (glxcmds.c:174)
   by 0x5D34F38: glXQueryExtensionsString (glxcmds.c:1307)

Fixes: eca8032f ("gallium: Add ARB_gl_spirv support")
Reviewed-by: Gert Wollny's avatarGert Wollny <>
Signed-off-by: default avatarAndrii Simiklit <>
Tested-by: Marge Bot <!3345>
Part-of: <!3345>
(cherry picked from commit ebaab897)
parent 31fa1c79
......@@ -1264,8 +1264,9 @@ get_version(struct pipe_screen *screen,
st_init_limits(screen, &consts, &extensions);
st_init_extensions(screen, &consts, &extensions, options, api);
return _mesa_get_version(&extensions, &consts, api);
version = _mesa_get_version(&extensions, &consts, api);
return version;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment