mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
glx: Prevent crashes when an extension isn't found
Avoid a NULL-pointer dereference.
Fixes: 2c8a85b712 ("glx: Stash a copy of the XExtCodes in the glx_display")
Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12751>
This commit is contained in:
parent
20ec247cb8
commit
d326d32e24
1 changed files with 7 additions and 1 deletions
|
|
@ -861,6 +861,7 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv)
|
|||
_X_HIDDEN struct glx_display *
|
||||
__glXInitialize(Display * dpy)
|
||||
{
|
||||
XExtCodes *codes;
|
||||
struct glx_display *dpyPriv, *d;
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
Bool glx_direct, glx_accel;
|
||||
|
|
@ -883,8 +884,13 @@ __glXInitialize(Display * dpy)
|
|||
if (!dpyPriv)
|
||||
return NULL;
|
||||
|
||||
dpyPriv->codes = *XInitExtension(dpy, __glXExtensionName);
|
||||
codes = XInitExtension(dpy, __glXExtensionName);
|
||||
if (!codes) {
|
||||
free(dpyPriv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dpyPriv->codes = *codes;
|
||||
dpyPriv->dpy = dpy;
|
||||
|
||||
/* This GLX implementation requires X_GLXQueryExtensionsString
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue