iris: Do not dereference nullptr with pipe_reference

../src/gallium/drivers/iris/iris_fence.h:54:8: runtime error: member access within null pointer of type 'struct iris_syncpt'

../src/gallium/drivers/iris/iris_fence.c:136:8: runtime error: member access within null pointer of type 'struct pipe_fence_handle'

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3825>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3825>
This commit is contained in:
Danylo Piliaiev 2020-02-14 15:37:23 +02:00
parent d800bcd9b9
commit 72154237fb
2 changed files with 4 additions and 2 deletions

View File

@ -133,7 +133,8 @@ iris_fence_reference(struct pipe_screen *p_screen,
struct pipe_fence_handle **dst,
struct pipe_fence_handle *src)
{
if (pipe_reference(&(*dst)->ref, &src->ref))
if (pipe_reference(*dst ? &(*dst)->ref : NULL,
src ? &src->ref : NULL))
iris_fence_destroy(p_screen, *dst);
*dst = src;

View File

@ -51,7 +51,8 @@ iris_syncpt_reference(struct iris_screen *screen,
struct iris_syncpt **dst,
struct iris_syncpt *src)
{
if (pipe_reference(&(*dst)->ref, &src->ref))
if (pipe_reference(*dst ? &(*dst)->ref : NULL,
src ? &src->ref: NULL))
iris_syncpt_destroy(screen, *dst);
*dst = src;