panfrost: Fix panfrost_bo_access memory leak
authorDaniel Ogorchock <daniel.ogorchock@garmin.com>
Mon, 6 Jan 2020 23:33:49 +0000 (17:33 -0600)
committerTomeu Vizoso <tomeu.vizoso@collabora.co.uk>
Mon, 13 Jan 2020 09:11:35 +0000 (09:11 +0000)
The bo access needs to be freed prior to removing it from its hash
table. This prevents leaking them over time.

Signed-off-by: Daniel Ogorchock <daniel.ogorchock@garmin.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3308>

src/gallium/drivers/panfrost/pan_job.c

index 208e287740a62fb6a139ba7966f1515ede36c99c..d1ce9c0ec3338925417573112361ce73d343d9b8 100644 (file)
@@ -380,8 +380,10 @@ panfrost_gc_fences(struct panfrost_context *ctx)
                 panfrost_bo_access_gc_fences(ctx, access, entry->key);
                 if (!util_dynarray_num_elements(&access->readers,
                                                 struct panfrost_batch_fence *) &&
-                    !access->writer)
+                    !access->writer) {
+                        ralloc_free(access);
                         _mesa_hash_table_remove(ctx->accessed_bos, entry);
+                }
         }
 }