]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Free empty stack list for code contexts
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 9 Feb 2022 16:36:14 +0000 (17:36 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 16 Feb 2022 17:52:01 +0000 (18:52 +0100)
While having the stack list created on demand, make sure to destroy it
when it is not required anymore. Otherwise it will be leaked without an
option to avoid that to happen.

vala/valacodecontext.vala

index 051cc2c00042aad3dbd7a490e5294a7770d08b45..01b99bdd16fac12e183fa75b5c4caf5c90df3ee8 100644 (file)
@@ -290,6 +290,11 @@ public class Vala.CodeContext {
                }
 
                context_stack->remove_at (context_stack->size - 1);
+
+               if (context_stack->size == 0) {
+                       delete context_stack;
+                       context_stack_key.set (null, null);
+               }
        }
 
        /**