aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lemon/patches/08-lemon-stp-memleak-fp.patch
blob: 07ff33e351becb5cf50c50c96610bf8fc6fdef99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CSA thought that stp would leak if State_insert returns early: when x3a is NULL
(memory allocation failure) or when the state existed before (cannot happen for
the initial state). So annotate it as such.
--- a/lemon.c
+++ b/lemon.c
@@ -990,7 +990,11 @@ PRIVATE struct state *getstate(struct lemon *lemp)
     stp->cfp = cfp;              /* Remember the configuration closure */
     stp->statenum = lemp->nstate++; /* Every state gets a sequence number */
     stp->ap = 0;                 /* No actions, yet. */
+#ifndef NDEBUG
+    int ret =
+#endif
     State_insert(stp,stp->bp);   /* Add to the state table */
+    assert(ret == 1);  /* CSA hint: stp did not leak, it has escaped. */
     buildshifts(lemp,stp);       /* Recursively compute successor states */
   }
   return stp;