summaryrefslogtreecommitdiff
path: root/spirv_reflect.c
diff options
context:
space:
mode:
Diffstat (limited to 'spirv_reflect.c')
-rw-r--r--spirv_reflect.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/spirv_reflect.c b/spirv_reflect.c
index 63f72de..5fc190e 100644
--- a/spirv_reflect.c
+++ b/spirv_reflect.c
@@ -3339,11 +3339,13 @@ static SpvReflectResult ParseExecutionModes(
}
for (size_t entry_point_idx = 0; entry_point_idx < p_module->entry_point_count; ++entry_point_idx) {
SpvReflectEntryPoint* p_entry_point = &p_module->entry_points[entry_point_idx];
- p_entry_point->execution_modes =
- (SpvExecutionMode*)calloc(p_entry_point->execution_mode_count, sizeof(*p_entry_point->execution_modes));
- if (IsNull(p_entry_point->execution_modes)) {
- SafeFree(indices);
- return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
+ if (p_entry_point->execution_mode_count > 0) {
+ p_entry_point->execution_modes =
+ (SpvExecutionMode*)calloc(p_entry_point->execution_mode_count, sizeof(*p_entry_point->execution_modes));
+ if (IsNull(p_entry_point->execution_modes)) {
+ SafeFree(indices);
+ return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
+ }
}
}