vc4: Fix leak in HW queries error path
authorErnestas Kulik <ernestas.kulik@gmail.com>
Thu, 30 Aug 2018 16:02:47 +0000 (19:02 +0300)
committerEric Anholt <eric@anholt.net>
Wed, 30 Jan 2019 00:14:13 +0000 (16:14 -0800)
Reported by Coverity: in the case where there exist hardware and
non-hardware queries, the code does not jump to err_free_query and leaks
the query.

CID: 1430194
Signed-off-by: Ernestas Kulik <ernestas.kulik@gmail.com>
Fixes: 9ea90ffb98fb ("broadcom/vc4: Add support for HW perfmon")
src/gallium/drivers/vc4/vc4_query.c

index 6e4681e93ccbd30cb7ff4a719cb574018688d57b..f08785f457f59bfb8a9c493e0468d1e595860561 100644 (file)
@@ -132,7 +132,7 @@ vc4_create_batch_query(struct pipe_context *pctx, unsigned num_queries,
 
         /* We can't mix HW and non-HW queries. */
         if (nhwqueries && nhwqueries != num_queries)
-                return NULL;
+                goto err_free_query;
 
         if (!nhwqueries)
                 return (struct pipe_query *)query;