i965: fix mem leak in error path
authorEric Engestrom <eric.engestrom@intel.com>
Fri, 9 Aug 2019 22:41:53 +0000 (23:41 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Sat, 10 Aug 2019 11:14:56 +0000 (12:14 +0100)
Fixes: 8ae6667992ccca41d088 ("intel/perf: move query_object into perf")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
src/mesa/drivers/dri/i965/brw_performance_query.c

index f7016e4dd15bc647f685a983e203be9bf3147169..16e467442bc0b0b389d8778a686efb23e82baa59 100644 (file)
@@ -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;