SUBST: free the sub-context also if we have a negative conditional.
authorWilfried Goesgens <dothebart@citadel.org>
Sat, 27 Oct 2012 18:34:05 +0000 (20:34 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sat, 27 Oct 2012 18:34:05 +0000 (20:34 +0200)
webcit/subst.c

index 95e7d47a9746c935f1bb1bc5d7a54dc15e72d834..6f85d04cd28b0bfca2d53aded61cf200af144732 100644 (file)
@@ -1851,7 +1851,7 @@ const StrBuf *ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, WCTemplputParams
                        else if (TokenRc < 0)
                        {
                                if ((TPtr != &TP) &&
-                                   (TPtr->ExitCTXID == TokenRc))
+                                   (TPtr->ExitCTXID == -TokenRc))
                                {
                                        UnStackDynamicContext(Target, &TPtr);
                                }
@@ -1872,10 +1872,15 @@ const StrBuf *ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, WCTemplputParams
                                                pTmpl->Tokens[i]->Flags, 
                                                TokenRc, 
                                                &TPtr);
-                                       if (rc == -TokenRc)
+                                       if (-rc == TokenRc)
                                        {
                                                TokenRc = 0;
                                                state = eNext;
+                                               if ((TPtr != &TP) &&
+                                                   (TPtr->ExitCTXID == - rc))
+                                               {
+                                                       UnStackDynamicContext(Target, &TPtr);
+                                               }
                                        }
                                }
                        }