Because the static types talloc their names at dlopen time,
talloc_freeing the types at DRI driver screen teardown means that if
the screen gets brought back up again, the names will point at freed
memory. talloc_autofree_context() exists to do just what we want
here: Free memory referenced across the program's lifetime so that we
avoid noise in memory leak checkers.
Fixes: bug #29722 (assertion failure in unigine).
glsl_type::init_talloc_type_ctx(void)
{
if (glsl_type::mem_ctx == NULL) {
- glsl_type::mem_ctx = talloc_init("glsl_type");
+ glsl_type::mem_ctx = talloc_autofree_context();
assert(glsl_type::mem_ctx != NULL);
}
}
hash_table_dtor(glsl_type::record_types);
glsl_type::record_types = NULL;
}
-
- if (glsl_type::mem_ctx != NULL) {
- talloc_free(glsl_type::mem_ctx);
- glsl_type::mem_ctx = NULL;
- }
}