Module: Mesa
Branch: thalloc
Commit: 0b0c16a5ab8107af99bea8f2adaf464fc4ecb3b5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b0c16a5ab8107af99bea8f2adaf464fc4ecb3b5

Author: Jakob Bornecrantz <[email protected]>
Date:   Wed Jan 19 02:28:41 2011 +0100

thalloc: Fix realloc on orphan blocks

This actually looks like its a bug from halloc that piglit valgrind tests
unsurfaced, the sequence that triggers it looks like this:

void *ptr = halloc(NULL, 1);
ptr = halloc(ptr, 2);

Signed-off-by: Jakob Bornecrantz <[email protected]>

---

 src/thalloc/halloc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/thalloc/halloc.c b/src/thalloc/halloc.c
index d71f328..256b2c3 100644
--- a/src/thalloc/halloc.c
+++ b/src/thalloc/halloc.c
@@ -101,7 +101,10 @@ void * halloc(void * ptr, size_t len)
                if (! p)
                        return NULL;
 
-               hlist_relink(&p->siblings);
+               if (!p->parent)
+                       hlist_init_item(&p->siblings);
+               else
+                       hlist_relink(&p->siblings);
                hlist_relink_head(&p->children);
 
                hlist_for_each_safe(i, tmp, &p->children)

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to