From 077a9c74789977e7a8ca551bef1dfdb5ebb8b51e Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 26 Aug 2021 11:24:37 +0200 Subject: [PATCH] zink: return false on failure We do this in the other pipe_buffer_map_range failure case, so it makes sense that we need to do it here as well. If we don't, we'll end up taking a crash in the check_query_results function, which will dereference that pointer. We also need to unmap the buffer if we fail, otherwise we'll leak. CID: 1475925 Reviewed-By: Mike Blumenkrantz Part-of: --- src/gallium/drivers/zink/zink_query.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c index b26cc96547a..cdeb44eefc7 100644 --- a/src/gallium/drivers/zink/zink_query.c +++ b/src/gallium/drivers/zink/zink_query.c @@ -469,6 +469,8 @@ get_query_result(struct pipe_context *pctx, if (!xfb_results) { if (wait) debug_printf("zink: xfb qbo read failed!"); + pipe_buffer_unmap(pctx, xfer); + return false; } } check_query_results(query, result, is_timestamp ? 1 : qbo->num_results, results, xfb_results);