diff --git a/.pick_status.json b/.pick_status.json index 409332455920..0fbdb619eeaa 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2263,7 +2263,7 @@ "description": "nouveau: fix nouveau_heap_destroy() memory leak", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "67635a0a713e54939f1f72ba8db2b3099988a925" }, diff --git a/src/gallium/drivers/nouveau/nouveau_heap.c b/src/gallium/drivers/nouveau/nouveau_heap.c index 3d415a5f30e2..496c4ec7a311 100644 --- a/src/gallium/drivers/nouveau/nouveau_heap.c +++ b/src/gallium/drivers/nouveau/nouveau_heap.c @@ -44,9 +44,14 @@ nouveau_heap_init(struct nouveau_heap **heap, void nouveau_heap_destroy(struct nouveau_heap **heap) { - if (!*heap) - return; - free(*heap); + struct nouveau_heap *current = *heap; + + while (current) { + struct nouveau_heap *const next = current->next; + free(current); + current = next; + } + *heap = NULL; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index 4df20f094b7f..86a351c6cf9f 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -632,7 +632,7 @@ nvc0_screen_destroy(struct pipe_screen *pscreen) nouveau_bo_ref(NULL, &screen->fence.bo); nouveau_bo_ref(NULL, &screen->poly_cache); - nouveau_heap_destroy(&screen->lib_code); + nouveau_heap_free(&screen->lib_code); nouveau_heap_destroy(&screen->text_heap); FREE(screen->tic.entries); @@ -883,7 +883,7 @@ nvc0_screen_resize_text_area(struct nvc0_screen *screen, struct nouveau_pushbuf nouveau_bo_ref(NULL, &screen->text); screen->text = bo; - nouveau_heap_destroy(&screen->lib_code); + nouveau_heap_free(&screen->lib_code); nouveau_heap_destroy(&screen->text_heap); /* XXX: getting a page fault at the end of the code buffer every few