diff options
-rw-r--r-- | spirv_reflect.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/spirv_reflect.c b/spirv_reflect.c index 8c70ebe..857837e 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; + } } } |