Skip to content

glx: add a missing nullptr check

Sid requested to merge Sid127/mesa:glx-nullptr into main

This caused all glx applications to SegFault when run via Zink with the following backtrace:

(gdb) bt
#0  0x00007ffff7a7a0ae in driDestroyConfigs (configs=0x0) at ../mesa/src/glx/dri_common.c:238
#1  0x00007ffff7a81161 in glx_screen_cleanup (psc=0x5555556063b0) at ../mesa/src/glx/glxext.c:742
#2  0x00007ffff7a8dafa in dri3_create_screen (screen=screen@entry=0, priv=priv@entry=0x555555603ed0, driver_name_is_inferred=driver_name_is_inferred@entry=true, return_zink=return_zink@entry=0x7fffffffdfc0) at ../mesa/src/glx/dri3_glx.c:610
#3  0x00007ffff7a802fb in AllocAndFetchScreenConfigs (dpy=dpy@entry=0x555555586da0, priv=priv@entry=0x555555603ed0, glx_driver=glx_driver@entry=(GLX_DRIVER_ZINK_INFER | GLX_DRIVER_SW | GLX_DRIVER_DRI3), driver_name_is_inferred=driver_name_is_inferred@entry=1) at ../mesa/src/glx/glxext.c:875
#4  0x00007ffff7a816fa in __glXInitialize (dpy=dpy@entry=0x555555586da0) at ../mesa/src/glx/glxext.c:1076
#5  0x00007ffff7a7cd6a in GetGLXPrivScreenConfig (dpy=0x555555586da0, scrn=0, ppriv=<synthetic pointer>, ppsc=<synthetic pointer>) at ../mesa/src/glx/glxcmds.c:148
#6  glXChooseVisual (dpy=0x555555586da0, screen=0, attribList=0x555555585020) at ../mesa/src/glx/glxcmds.c:1082
#7  0x000055555555620c in ?? ()
#8  0x00007ffff7c05e08 in ?? () from /usr/lib/libc.so.6
#9  0x00007ffff7c05ecc in __libc_start_main () from /usr/lib/libc.so.6
#10 0x0000555555556d75 in ?? ()

Tested on the following applications: glxgears, glxinfo, Plasma X11 session on Zink + NVK on an RTX 3070

Merge request reports

Loading