Commit 882215e1382e9114387efd97662f08f76d4618f5

Ryan C. Gordon 2018-02-11T18:16:01

vulkan: Fix assignment of vkGetInstanceProcAddr on Windows. "*(void**)pfn = LoadAddress()" would cast the NULL pointer in pfn to a void**, and then dereference it, which wasn't what we wanted. Replaced with a clearer cast operation.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c
index 9fc1f01..42e8bef 100644
--- a/src/video/windows/SDL_windowsvulkan.c
+++ b/src/video/windows/SDL_windowsvulkan.c
@@ -57,7 +57,7 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path)
         return -1;
     SDL_strlcpy(_this->vulkan_config.loader_path, path,
                 SDL_arraysize(_this->vulkan_config.loader_path));
-    *(void**)vkGetInstanceProcAddr = SDL_LoadFunction(
+    vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) SDL_LoadFunction(
         _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
     if(!vkGetInstanceProcAddr)
         goto fail;