[gtk+/wip/baedert/gl: 36/59] vulkan: Avoid uninitialized local



commit 5793165264d88b926bead42496eb1bd28c7ce2eb
Author: Timm Bäder <mail baedert org>
Date:   Sat Nov 18 16:51:27 2017 +0100

    vulkan: Avoid uninitialized local
    
    In case none of the vkEnumeratePhysicalDevices calls set n_devices to
    something useful, we later tried to use it without ever initializing it
    to something useful.

 gdk/gdkvulkancontext.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index f442534..6b8d052 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -599,7 +599,7 @@ gdk_display_create_vulkan_device (GdkDisplay  *display,
 {
   uint32_t i, j;
 
-  uint32_t n_devices;
+  uint32_t n_devices = 0;
   GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, NULL);
   VkPhysicalDevice *devices = g_newa (VkPhysicalDevice, n_devices);
   GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, devices);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]