]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: g_clear_error() sets pointer target to NULL already
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 2 Mar 2020 20:05:38 +0000 (21:05 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 2 Mar 2020 20:05:48 +0000 (21:05 +0100)
codegen/valagerrormodule.vala

index 057e982bad8825f449090f2fddfc7c3e9d4608bd..b618f7b15e3e9b162f77641924e7860664fb8e95 100644 (file)
@@ -363,6 +363,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                if (clause.error_variable != null) {
                        visit_local_variable (clause.error_variable);
                        ccode.add_assignment (get_variable_cexpression (get_local_cname (clause.error_variable)), get_inner_error_cexpression ());
+                       ccode.add_assignment (get_inner_error_cexpression (), new CCodeConstant ("NULL"));
                } else {
                        // error object is not used within catch statement, clear it
                        cfile.add_include ("glib.h");
@@ -370,7 +371,6 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                        cclear.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_inner_error_cexpression ()));
                        ccode.add_expression (cclear);
                }
-               ccode.add_assignment (get_inner_error_cexpression (), new CCodeConstant ("NULL"));
 
                clause.body.emit (this);