From: joonbum.ko Date: Mon, 29 Jan 2018 06:55:12 +0000 (+0900) Subject: samples: Fixed some dereferencing problems. X-Git-Tag: accepted/tizen/unified/20180208.163712~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17674bee678b088c6f08a2bf508618e9d3a8f2ee;p=platform%2Fcore%2Fuifw%2Fvulkan-wsi-tizen.git samples: Fixed some dereferencing problems. - DEREF_OF_NULL.RET.ALLOC WGID: 305109, 305113, 305118 - DEREF_AFTER_NULL.EX WGID: 305122 Change-Id: If7e12b85c33623345eb782d3171b93a8e5cda274 Signed-off-by: joonbum.ko --- diff --git a/samples/tri.c b/samples/tri.c index 97a5766..dcbfd86 100644 --- a/samples/tri.c +++ b/samples/tri.c @@ -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);