From: Andrii Simiklit Date: Fri, 19 Jul 2019 14:39:07 +0000 (+0300) Subject: etnaviv: fix a null pointer dereference X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc471f2ef8ffd6dcac170b82724b2e6069797a34;p=mesa.git etnaviv: fix a null pointer dereference This issue was found by cppcheck Signed-off-by: Andrii Simiklit Reviewed-by: Eric Engestrom Reviewed-by: Lucas Stach --- diff --git a/src/etnaviv/drm/etnaviv_bo.c b/src/etnaviv/drm/etnaviv_bo.c index 6e952fa4785..2b1fbbbc3c7 100644 --- a/src/etnaviv/drm/etnaviv_bo.c +++ b/src/etnaviv/drm/etnaviv_bo.c @@ -238,11 +238,11 @@ out_unlock: /* destroy a buffer object */ void etna_bo_del(struct etna_bo *bo) { - struct etna_device *dev = bo->dev; - if (!bo) return; + struct etna_device *dev = bo->dev; + if (!p_atomic_dec_zero(&bo->refcnt)) return;