ralloc: Fix ralloc_parent() of memory allocated out of the NULL context.
If an object is allocated out of the NULL context, info->parent will be NULL. Using the PTR_FROM_HEADER macro would be incorrect: it would say that ralloc_parent(ralloc_context(NULL)) == sizeof(ralloc_header). Fixes the new "null_parent" unit test. NOTE: This is a candidate for the 7.9, 7.10, 7.11, and 8.0 branches. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
2224fb6047
commit
1559b2e2d7
1 changed files with 1 additions and 1 deletions
|
|
@ -278,7 +278,7 @@ ralloc_parent(const void *ptr)
|
|||
return NULL;
|
||||
|
||||
info = get_header(ptr);
|
||||
return PTR_FROM_HEADER(info->parent);
|
||||
return info->parent ? PTR_FROM_HEADER(info->parent) : NULL;
|
||||
}
|
||||
|
||||
static void *autofree_context = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue