From 6cdf72ac77e4d574cd755d36ef5c061bceb3ccd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 19 Apr 2018 13:04:41 +0200 Subject: [PATCH] Fix Coverity reports of uninitialized scalar variable Fixes most current reports on Coverity Scan of uninitialized scalar variable (CWE-457): https://cwe.mitre.org/data/definitions/457.html These happen most of the time (in our code) when instanciating structs without a constructor (or with an incomplete one), and later returning the instance. This is sometimes intended though, as some parameters are only used in some situations and should not be double-initialized for performance reasons (e.g. `constant` in ShaderLanguage::Token). --- visual_script.cpp | 1 + visual_script.h | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/visual_script.cpp b/visual_script.cpp index ef68054..03bc4c1 100644 --- a/visual_script.cpp +++ b/visual_script.cpp @@ -2028,6 +2028,7 @@ void VisualScriptInstance::create(const Ref &p_script, Object *p_o function.flow_stack_size = 0; function.pass_stack_size = 0; function.node_count = 0; + Map local_var_indices; if (function.node < 0) { diff --git a/visual_script.h b/visual_script.h index 69bb522..dad9c68 100644 --- a/visual_script.h +++ b/visual_script.h @@ -374,12 +374,10 @@ class VisualScriptInstance : public ScriptInstance { int node; int max_stack; int trash_pos; - int return_pos; int flow_stack_size; int pass_stack_size; int node_count; int argument_count; - bool valid; }; Map functions;