dzn: Don't crash when libd3d12.so can't be found
authorJan Alexander Steffens (heftig) <heftig@archlinux.org>
Sun, 4 Dec 2022 00:21:45 +0000 (00:21 +0000)
committerEric Engestrom <eric@engestrom.ch>
Wed, 14 Dec 2022 20:47:00 +0000 (20:47 +0000)
commitff39ada94f841d82a85310e5dff6135eb123aa6d
tree5f393b7f6d1a108adf24bcfcefae17d1e7fa4840
parent1b27820b769087c1ff42ddd505a19be18b182e92
dzn: Don't crash when libd3d12.so can't be found

`dzn_instance_create` will call `dzn_instance_destroy` when the d3d12
library fails to load. Just like the issue in `d3d12_screen`, this will
lead to a crash because `d3d12_mod` is NULL.

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 b5133894005720db24a8e0cc17e047a291953ff4)
.pick_status.json
src/microsoft/vulkan/dzn_device.c