On 18/08/17 09:05, Kenneth Graunke wrote:
On Thursday, August 17, 2017 10:22:15 AM PDT Jason Ekstrand wrote:
---
  src/util/ralloc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/ralloc.c b/src/util/ralloc.c
index bf46439..4015c7e 100644
--- a/src/util/ralloc.c
+++ b/src/util/ralloc.c
@@ -285,7 +285,7 @@ ralloc_steal(const void *new_ctx, void *ptr)
        return;
info = get_header(ptr);
-   parent = get_header(new_ctx);
+   parent = new_ctx ? get_header(new_ctx) : NULL;
unlink_block(info);

This patch is:
Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>

ralloc_adopt() doesn't properly handle NULL either, but frankly...
reparenting an unknown set of children to the NULL context sounds like a
recipe for leaks.  :)

I agree. I was wondering if we should create a special function for this:

ralloc_steal_to_NULL_ctx(void *ptr)

To void issues like:

ralloc_free(parent->child);
parent->child = NULL;

... lots of code in between ...

ralloc_steal(parent->child, ptr);

ralloc_free(parent);

Feel free to tell me I'm being paranoid.

 So I'm not sure it's worth fixing.



_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to