summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-07-31 19:46:22 +0100
committerEmil Velikov <[email protected]>2017-08-02 20:42:19 +0100
commit31a6750988d7dd431f72ff1ff11bfca83bde5d8c (patch)
tree8f2a3b2f6fca2454ccf3b7c1d4a2e71b8a44f307 /src/gallium/state_trackers/dri
parentdd9eb8db13b85a764d29c0c2fa1b0c416fae7581 (diff)
st/dri: NULL check before deref DRI loader .getCapability
One could have vX+1 which introduces another entrypoint without implementing older ones. v2: Rebase, while keeping loaderPrivate Fixes: 1bf703e4ea5 ("dri_interface,egl,gallium: only expose RGBA visuals on Android") Cc: 17.2 <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index f888abd6e70..b992d24068b 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -93,10 +93,12 @@ dri_loader_get_cap(struct dri_screen *screen, enum dri_loader_cap cap)
const __DRIdri2LoaderExtension *dri2_loader = screen->sPriv->dri2.loader;
const __DRIimageLoaderExtension *image_loader = screen->sPriv->image.loader;
- if (dri2_loader && dri2_loader->base.version >= 4)
+ if (dri2_loader && dri2_loader->base.version >= 4 &&
+ dri2_loader->getCapability)
return dri2_loader->getCapability(screen->sPriv->loaderPrivate, cap);
- if (image_loader && image_loader->base.version >= 2)
+ if (image_loader && image_loader->base.version >= 2 &&
+ image_loader->getCapability)
return image_loader->getCapability(screen->sPriv->loaderPrivate, cap);
return 0;