]> 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 21:30:14 +0000 (22:30 +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 dc1421e6c2d92af63015c0ab3c0add99311757f5..f52dd602a363489770cdf5edfc9ecf63e666b400 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);
+               }
        }
 
        /**