From d7eb40962bbf62b561cd51be94257786b2d2bbcc Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 9 Aug 2019 23:41:53 +0100 Subject: [PATCH] i965: fix mem leak in error path Fixes: 8ae6667992ccca41d088 ("intel/perf: move query_object into perf") Signed-off-by: Eric Engestrom Reviewed-by: Mark Janes --- src/mesa/drivers/dri/i965/brw_performance_query.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c index f7016e4dd15..16e467442bc 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_query.c +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c @@ -350,8 +350,10 @@ brw_new_perf_query_object(struct gl_context *ctx, unsigned query_index) return NULL; struct brw_perf_query_object *brw_query = calloc(1, sizeof(struct brw_perf_query_object)); - if (unlikely(!brw_query)) + if (unlikely(!brw_query)) { + gen_perf_delete_query(perf_ctx, obj); return NULL; + } brw_query->query = obj; return &brw_query->base; -- 2.30.2