[Mesa-dev] [PATCH] gbm: avoid null pointer dereference

Daniel Stone daniel at fooishbar.org
Mon Jul 17 14:20:22 UTC 2017


Hi,

On 17 July 2017 at 15:02, Gwan-gyeong Mun <elongbug at gmail.com> wrote:
> 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.

This is not true. The code here does not perform a dereference of
surf->base.modifiers (the only dereference occurs on surf). free()
itself is explicitly specified to be safe when passing NULL:
'If ptr is a null pointer, no action shall occur.'
  — http://pubs.opengroup.org/onlinepubs/009695399/functions/free.html

Cheers,
Daniel


More information about the mesa-dev mailing list