[Mesa-dev] [PATCH 2/3] st/dri: NULL check before deref DRI loader .getCapability

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 31 13:19:12 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

One could have vX+1 which introduces another entrypoint without
implementing older ones.

Fixes: 1bf703e4ea5 ("dri_interface,egl,gallium: only expose RGBA visuals
on Android")
Cc: Marek Olšák <maraeo at gmail.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/gallium/state_trackers/dri/dri_screen.c | 6 ++++--
 1 file 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 0442a2b6667..6b8b8080aff 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -130,10 +130,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(cap);
 
-   if (image_loader && image_loader->base.version >= 2)
+   if (image_loader && image_loader->base.version >= 2 &&
+       image_loader->getCapability)
       return image_loader->getCapability(cap);
 
    return 0;
-- 
2.13.3



More information about the mesa-dev mailing list