]> 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, 9 Feb 2022 17:06:10 +0000 (18:06 +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 9fc211f7a3a85b104c3833bbc420cd5de17ae46d..f96f87911c4e2f4b94a8b3f77e8b9a78db71c48f 100644 (file)
@@ -286,6 +286,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);
+               }
        }
 
        /**