anv: avoid null pointer dereference
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 3 May 2017 05:06:01 +0000 (22:06 -0700)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 8 May 2017 13:38:27 +0000 (14:38 +0100)
The application might not give an output structure.

CID: 1405765 (Null pointer dereferences)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/intel/vulkan/anv_formats.c

index 4c930eda1dd44648249ae13b6ade5d0e04d2dd47..c39cec3800aca31c84864d41c5823432a7f3e4f3 100644 (file)
@@ -715,7 +715,8 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR(
    if (external_info && external_info->handleType != 0) {
       switch (external_info->handleType) {
       case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX:
-         external_props->externalMemoryProperties = prime_fd_props;
+         if (external_props)
+            external_props->externalMemoryProperties = prime_fd_props;
          break;
       default:
          /* From the Vulkan 1.0.42 spec: