[PATCH 3/7] cex: fix lssi leaks

Vincent Imbimbo <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
* src/lssi.c (shortest_path_from_start): free the root of shortest_path_from_start search.
free eligible bitset.
---
 src/lssi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lssi.c b/src/lssi.c
index 95261b3f..293daafb 100644
--- a/src/lssi.c
+++ b/src/lssi.c
@@ -159,9 +159,9 @@ shortest_path_from_start (state_item_number target, symbol_number next_sym)
   bitset il = bitset_create (nsyms, BITSET_FIXED);
   bitset_set (il, 0);
   lssi *init = new_lssi (0, NULL, il, true);
-  gl_list_t queue = gl_list_create (GL_LINKED_LIST, NULL, NULL,
-                                    NULL,
-                                    true, 1, (const void **) &init);
+  gl_list_t queue = gl_list_create_empty (GL_LINKED_LIST, NULL, NULL,
+                                          NULL, true);
+  append_lssi (init, visited, queue);
   // breadth-first search
   bool finished = false;
   lssi *n;
@@ -234,6 +234,8 @@ shortest_path_from_start (state_item_number target, symbol_number next_sym)
             bitset_free (lookahead);
         }
     }
+
+  bitset_free (eligible);
   if (!finished)
     {
       gl_list_free (queue);
-- 
2.20.1 (Apple Git-117)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.