drm-shim: fix with asan

It seems GCC+AddressSanitizer calls open and readlink after
destroy_shim(), so those need to still work.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37055>
This commit is contained in:
Rhys Perry 2025-08-28 11:22:53 +01:00 committed by Marge Bot
parent 858386da06
commit 20705e89e9

View file

@ -189,6 +189,8 @@ drm_shim_override_file(const char *contents, const char *path_format, ...)
override->contents = strdup(contents);
}
static uint32_t inited = 0;
static void
destroy_shim(void)
{
@ -196,6 +198,10 @@ destroy_shim(void)
free(render_node_path);
free(render_node_dirent_name);
free(subsystem_path);
render_node_minor = -1;
file_overrides_count = 0;
p_atomic_set(&inited, 0);
}
/* Initialization, which will be called from the first general library call
@ -204,8 +210,6 @@ destroy_shim(void)
static void
init_shim(void)
{
static uint32_t inited = 0;
drm_shim_debug = debug_get_bool_option("DRM_SHIM_DEBUG", false);
/* We can't lock this, because we recurse during initialization. */