glx: Fix SEGV due to dereferencing a NULL ptr from XCB-GLX.

When run in optirun, applications that linked to `libGLX.so` and then
proceeded to querying Mesa for extension strings caused a SEGV in Mesa.

`glXQueryExtensionsString` was calling a chain of functions that
eventually led to `__glXQueryServerString`. This function would call
`xcb_glx_query_server_string` then `xcb_glx_query_server_string_reply`.
The latter for some unknown reason returned `NULL`. Passing this `NULL`
to `xcb_glx_query_server_string_string_length` would cause a SEGV as the
function tried to dereference it.

The reason behind the function returning `NULL` is yet to be determined,
however, simply checking that the ptr is not `NULL` resolves this. A
similar check has been added to `__glXGetString` for completeness sake,
although not immediately necessary.

In addition to that, we stumbled into a similar problem in
`AllocAndFetchScreenConfigs` which tries to access the configs to free
them if `__glXQueryServerString` fails. This, of course, SEGVs, because the
configs are yet to have been allocated. Simply continuing past the configs
if their config ptrs are `NULL` resolves this. We also switch to `calloc`
to make sure that the config ptrs are `NULL` by default, and not some
uninitialized value.

Cc: mesa-stable@lists.freedesktop.org
Fixes: 24b8a8cf "glx: implement __glXGetString, hide __glXGetStringFromServer"
Fixes: cb3610e3 "Import the GLX client side library, formerly from xc/lib/GL/glx. Build it "
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hal Gentz <zegentzy@protonmail.com>
22 jobs for !1631 with optirun_segv_fix in 21 minutes and 29 seconds (queued for 1 minute and 15 seconds)
detached
Status Name Job ID Coverage
  Containers Build
passed debian #569227

00:00:25

 
  Build+Test
passed meson-arm64 #569236

00:01:24

passed meson-armhf #569235

00:01:56

passed meson-clang #569230

00:09:36

passed meson-clover #569233

00:11:20

passed meson-i386 #569237

00:02:39

passed meson-main #569228

00:11:44

passed meson-swr-glvnd #569229

00:06:12

passed meson-vulkan #569234

00:04:05

passed scons-llvm #569239

00:04:34

passed scons-nollvm #569238

00:04:02

passed scons-swr #569231

00:06:45

passed scons-win64 #569232

00:07:19

 
  Test
passed test-llvmpipe-gles2 1/4 #569240

00:04:10

passed test-llvmpipe-gles2 2/4 #569241

00:04:59

passed test-llvmpipe-gles2 3/4 #569242

00:04:10

passed test-llvmpipe-gles2 4/4 #569243

00:04:22

passed test-softpipe-gles2 1/4 #569244

00:01:50

passed test-softpipe-gles2 2/4 #569245

00:01:39

passed test-softpipe-gles2 3/4 #569246

00:01:40

passed test-softpipe-gles2 4/4 #569247

00:01:35

passed test-softpipe-gles3-limited #569248

00:04:31