summaryrefslogtreecommitdiff
path: root/codegen
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-04-12 09:21:48 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2021-04-12 09:24:12 +0200
commit3c69cebf43a9dd15d13b27889000599d42846348 (patch)
treeb8752155abe2e3149b3479e9ce75601ea3a021fb /codegen
parent1cb798d305f177a5f9492e74a2cc875ceaa8ad7b (diff)
downloadvala-3c69cebf43a9dd15d13b27889000599d42846348.tar.gz
codegen: Don't free unowned heap allocated struct
Regression of 63551acaf0d83fac8b50904c2759c1098fbfaa71
Diffstat (limited to 'codegen')
-rw-r--r--codegen/valaccodebasemodule.vala3
1 files changed, 2 insertions, 1 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 8df6b9c13..b36fe7b4e 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5477,7 +5477,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
while (inner_expr is CastExpression) {
inner_expr = ((CastExpression) inner_expr).inner;
}
- if (!(inner_expr.symbol_reference is Variable || inner_expr is ElementAccess)) {
+ if (inner_expr.value_type.value_owned
+ && !(inner_expr.symbol_reference is Variable || inner_expr is ElementAccess)) {
// heap allocated struct leaked, destroy it
var value = new GLibValue (new PointerType (new VoidType ()), innercexpr);
temp_ref_values.insert (0, value);