[vala/0.40] codegen: Don't cause double-free due append_local_free() in uncaught-errors
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] codegen: Don't cause double-free due append_local_free() in uncaught-errors
- Date: Wed, 9 Oct 2019 17:33:25 +0000 (UTC)
commit 84e8171497a21d4e9747866ddc7d4e6c09c52d17
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Aug 29 16:38:25 2019 +0200
codegen: Don't cause double-free due append_local_free() in uncaught-errors
See https://gitlab.gnome.org/GNOME/vala/issues/838
codegen/valagerrormodule.vala | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index b394448ae..d52c66894 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -115,9 +115,13 @@ public class Vala.GErrorModule : CCodeDelegateModule {
}
}
- void uncaught_error_statement (CCodeExpression inner_error, bool unexpected = false) {
+ void uncaught_error_statement (CCodeExpression inner_error, bool unexpected = false, CodeNode?
start_at = null) {
// free local variables
- append_local_free (current_symbol);
+ if (start_at is TryStatement) {
+ append_local_free (start_at.parent_node as Block);
+ } else {
+ append_local_free (current_symbol);
+ }
var ccritical = new CCodeFunctionCall (new CCodeIdentifier ("g_critical"));
ccritical.add_argument (new CCodeConstant (unexpected ? "\"file %s: line %d: unexpected
error: %s (%s, %d)\"" : "\"file %s: line %d: uncaught error: %s (%s, %d)\""));
@@ -256,7 +260,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
// as jump out of finally block is not supported
} else {
// should never happen with correct bindings
- uncaught_error_statement (get_inner_error_cexpression (), true);
+ uncaught_error_statement (get_inner_error_cexpression (), true, current_try);
}
} else if (current_method != null && current_method.get_error_types ().size > 0) {
// current method can fail, propagate error
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]