d3d12: Don't crash when libd3d12.so can't be found

`d3d12_destroy_screen` is called by `d3d12_create_dxcore_screen` after
`d3d12_init_screen_base` fails and attempts to call `util_dl_close` on
a NULL pointer, leading to an abort.

To fix this, only close the library after if it was actually opened.

Cc: mesa-stable
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20145>
(cherry picked from commit b3d1ae19f2)
This commit is contained in:
Jan Alexander Steffens (heftig) 2022-12-04 00:17:57 +00:00 committed by Eric Engestrom
parent d43425f7e0
commit 1b27820b76
2 changed files with 3 additions and 2 deletions

View file

@ -4018,7 +4018,7 @@
"description": "d3d12: Don't crash when libd3d12.so can't be found",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -741,7 +741,8 @@ d3d12_destroy_screen(struct d3d12_screen *screen)
slab_destroy_parent(&screen->transfer_pool);
mtx_destroy(&screen->submit_mutex);
mtx_destroy(&screen->descriptor_pool_mutex);
util_dl_close(screen->d3d12_mod);
if (screen->d3d12_mod)
util_dl_close(screen->d3d12_mod);
glsl_type_singleton_decref();
FREE(screen);
}