diff options
author | David Robillard <d@drobilla.net> | 2023-01-11 16:04:49 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-01-11 17:06:40 -0500 |
commit | a92b56e6455aa23a1b4dff8b1636506175243ea4 (patch) | |
tree | f66029a268b739fefdd5e81f871277ce27e3f4c2 /src | |
parent | 3c75c0d65dfcf1281e53f1d91d5ef236216bf602 (diff) | |
download | pugl-a92b56e6455aa23a1b4dff8b1636506175243ea4.tar.gz pugl-a92b56e6455aa23a1b4dff8b1636506175243ea4.tar.bz2 pugl-a92b56e6455aa23a1b4dff8b1636506175243ea4.zip |
Fix potential leak
Diffstat (limited to 'src')
-rw-r--r-- | src/x11_vulkan.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/x11_vulkan.c b/src/x11_vulkan.c index 5b6745e..54b1218 100644 --- a/src/x11_vulkan.c +++ b/src/x11_vulkan.c @@ -36,15 +36,18 @@ puglNewVulkanLoader(PuglWorld* PUGL_UNUSED(world)) PuglVulkanLoader* const loader = (PuglVulkanLoader*)calloc(1, sizeof(PuglVulkanLoader)); - if (loader) { - loader->libvulkan = libvulkan; + if (!loader) { + dlclose(libvulkan); + return NULL; + } - loader->vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym( - loader->libvulkan, "vkGetInstanceProcAddr"); + loader->libvulkan = libvulkan; - loader->vkGetDeviceProcAddr = - (PFN_vkGetDeviceProcAddr)dlsym(loader->libvulkan, "vkGetDeviceProcAddr"); - } + loader->vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym( + loader->libvulkan, "vkGetInstanceProcAddr"); + + loader->vkGetDeviceProcAddr = + (PFN_vkGetDeviceProcAddr)dlsym(loader->libvulkan, "vkGetDeviceProcAddr"); return loader; } |