From 068d6283da53ac34bc66759529f77b9b6d047dc7 Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Fri, 13 Jan 2017 14:01:35 -0700 Subject: loader: Fix static analysis warnings Handle possible null pointer dereferences. Misc other warnings, nothing too serious. Not addressing alloca concerns yet. Change-Id: I712a6b4996a4d900604867e373521ff4d1c53df5 --- loader/debug_report.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'loader/debug_report.c') diff --git a/loader/debug_report.c b/loader/debug_report.c index b404a51a..15233bc2 100644 --- a/loader/debug_report.c +++ b/loader/debug_report.c @@ -336,8 +336,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback( pAllocator->pUserData, inst->total_icd_count * sizeof(VkDebugReportCallbackEXT), sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); - memset(icd_info, 0, - inst->total_icd_count * sizeof(VkDebugReportCallbackEXT)); + if (icd_info) { + memset(icd_info, 0, + inst->total_icd_count * sizeof(VkDebugReportCallbackEXT)); + } } else { #endif icd_info = @@ -407,7 +409,7 @@ out: continue; } - if (icd_info[storage_idx]) { + if (icd_info && icd_info[storage_idx]) { icd_term->DestroyDebugReportCallbackEXT( icd_term->instance, icd_info[storage_idx], pAllocator); } -- cgit v1.2.3