samples: Fixed some dereferencing problems. 22/168622/1
authorjoonbum.ko <joonbum.ko@samsung.com>
Mon, 29 Jan 2018 06:55:12 +0000 (15:55 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Mon, 29 Jan 2018 06:55:15 +0000 (15:55 +0900)
 - DEREF_OF_NULL.RET.ALLOC WGID: 305109, 305113, 305118
 - DEREF_AFTER_NULL.EX WGID: 305122

Change-Id: If7e12b85c33623345eb782d3171b93a8e5cda274
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
samples/tri.c

index 97a5766..dcbfd86 100644 (file)
@@ -1783,6 +1783,7 @@ static void demo_create_window(struct demo *demo) {
                wl_shell_surface_add_listener(demo->shell_surface,
                                                                          &shell_surface_listener, demo);
                wl_shell_surface_set_toplevel(demo->shell_surface);
+               wl_shell_surface_set_title(demo->shell_surface, APP_SHORT_NAME);
        }
 
        wl_surface_set_user_data(demo->wl_surface, demo);
@@ -2010,6 +2011,7 @@ static void demo_init_vk(struct demo *demo) {
     if (gpu_count > 0) {
         VkPhysicalDevice *physical_devices =
             malloc(sizeof(VkPhysicalDevice) * gpu_count);
+        assert(physical_devices);
         err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count,
                                          physical_devices);
         assert(!err);
@@ -2251,6 +2253,7 @@ static void demo_init_vk_swapchain(struct demo *demo) {
     // Iterate over each queue to learn whether it supports presenting:
     VkBool32 *supportsPresent =
         (VkBool32 *)malloc(demo->queue_count * sizeof(VkBool32));
+    assert(supportsPresent);
     for (i = 0; i < demo->queue_count; i++) {
         demo->fpGetPhysicalDeviceSurfaceSupportKHR(demo->gpu, i, demo->surface,
                                                    &supportsPresent[i]);
@@ -2317,6 +2320,7 @@ static void demo_init_vk_swapchain(struct demo *demo) {
     assert(!err);
     VkSurfaceFormatKHR *surfFormats =
         (VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR));
+    assert(surfFormats);
     err = demo->fpGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface,
                                                      &formatCount, surfFormats);
     assert(!err);