aboutsummaryrefslogtreecommitdiff
path: root/loader/debug_report.c
diff options
context:
space:
mode:
authorKarl Schultz <karl@lunarg.com>2017-01-13 14:01:35 -0700
committerKarl Schultz <karl.w.schultz@gmail.com>2017-01-14 10:22:38 -0700
commit068d6283da53ac34bc66759529f77b9b6d047dc7 (patch)
tree7a7221677d564ffa70b456786e8f73ff605af4a7 /loader/debug_report.c
parent0366546a758cbd04eb2a6707ea14cd9bd22e76cc (diff)
downloadusermoji-068d6283da53ac34bc66759529f77b9b6d047dc7.tar.xz
loader: Fix static analysis warnings
Handle possible null pointer dereferences. Misc other warnings, nothing too serious. Not addressing alloca concerns yet. Change-Id: I712a6b4996a4d900604867e373521ff4d1c53df5
Diffstat (limited to 'loader/debug_report.c')
-rw-r--r--loader/debug_report.c8
1 files changed, 5 insertions, 3 deletions
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);
}