[Mesa-dev] [PATCH] gbm: avoid null pointer dereference
Gwan-gyeong Mun
elongbug at gmail.com
Mon Jul 17 14:02:12 UTC 2017
gbm_dri_surface_create() might create gbm_surface without modifiers.
therefore, gbm_dri_surface_destroy() needs to check modifiers is null or not
prior to free it.
Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
---
src/gbm/backends/dri/gbm_dri.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index ecb360773c..078ee1afda 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -1362,7 +1362,8 @@ gbm_dri_surface_destroy(struct gbm_surface *_surf)
{
struct gbm_dri_surface *surf = gbm_dri_surface(_surf);
- free(surf->base.modifiers);
+ if (surf->base.modifiers)
+ free(surf->base.modifiers);
free(surf);
}
--
2.13.3
More information about the mesa-dev
mailing list