scossu 2 тижнів тому
батько
коміт
81abc6eb59
11 змінених файлів з 1597 додано та 102 видалено
  1. 2 2
      include/term.h
  2. 8 1
      lua/Makefile
  3. 60 0
      lua/parse_valgrind_supp.sh
  4. 11 3
      lua/scratch.lua
  5. 7 91
      lua/src/graph.c
  6. 12 1
      lua/src/stackdump.h
  7. 122 2
      lua/src/term.c
  8. 661 0
      lua/valgrind-lua-base.supp
  9. 712 0
      lua/valgrind-lua.supp
  10. 0 1
      src/graph.c
  11. 2 1
      src/term.c

+ 2 - 2
include/term.h

@@ -593,10 +593,10 @@ LSUP_link_map_type (const LSUP_LinkMap *map);
  * @param[in] lmap Link map handle obtained with #LSUP_link_map_new().
  *
  * @param[in] term Term to be associated with the given object list. The
- *  link map structure takes ownership of the term.
+ *  link map takes ownership of the term.
  *
  * @param[in] tset term set to be associated with the given term. The link
- *  list structire takes ownership of the term set and the terms in it.
+ *  map takes ownership of the term set and the terms in it.
  *
  * @return LSUP_OK on success; LSUP_MEM_ERR on allocation error.
  */

+ 8 - 1
lua/Makefile

@@ -1,5 +1,5 @@
 INCLUDE = -I/usr/local/include/lsup
-CFLAGS = -DDEBUG -Wall -fPIC $(INCLUDE)
+CFLAGS = -DDEBUG -Og -ggdb -Wall -fPIC $(INCLUDE)
 LDFLAGS = -L/usr/local/lib -llua -llsuprdf_dbg
 
 LUAC_SRC = $(wildcard src/*.c)
@@ -20,3 +20,10 @@ $(OBJ): src/*.c src/lua_lsup.h
 .PHONY: clean
 clean:
 	$(RM) lib/*.so
+
+
+.PHONY: memcheck
+memcheck:
+	valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes \
+	--suppressions=valgrind-lua.supp \
+	lua -i scratch.lua

+ 60 - 0
lua/parse_valgrind_supp.sh

@@ -0,0 +1,60 @@
+#! /usr/bin/awk -f
+# Copyright: 2022 David Hart
+# Licence:   wxWindows licence
+#
+# A script to extract the actual suppression info from the output of (for example) valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-suppressions=all ./minimal
+# The desired bits are between ^{ and ^} (including the braces themselves).
+# The combined output should either be appended to /usr/lib/valgrind/default.supp, or placed in a .supp of its own
+# If the latter, either tell valgrind about it each time with --suppressions=<filename>, or add that line to ~/.valgrindrc
+
+# NB This script uses the |& operator, which I believe is gawk-specific. In case of failure, check that you're using gawk rather than some other awk
+
+# The script looks for suppressions. When it finds one it stores it temporarily in an array,
+# and also feeds it line by line to the external app 'md5sum' which generates a unique checksum for it.
+# The checksum is used as an index in a different array. If an item with that index already exists the suppression must be a duplicate and is discarded.
+
+BEGIN { suppression=0; md5sum = "md5sum" }
+  # If the line begins with '{', it's the start of a supression; so set the var and initialise things
+  /^{/  {
+           suppression=1;  i=0; next 
+        }
+  # If the line begins with '}' its the end of a suppression
+  /^}/  {
+          if (suppression)
+           { suppression=0;
+             close(md5sum, "to")  # We've finished sending data to md5sum, so close that part of the pipe
+             ProcessInput()       # Do the slightly-complicated stuff in functions
+             delete supparray     # We don't want subsequent suppressions to append to it!
+           }
+     }
+  # Otherwise, it's a normal line. If we're inside a supression, store it, and pipe it to md5sum. Otherwise it's cruft, so ignore it
+     { if (suppression)
+         { 
+            supparray[++i] = $0
+            print |& md5sum
+         }
+     }
+
+
+ function ProcessInput()
+ {
+    # Pipe the result from md5sum, then close it     
+    md5sum |& getline result
+    close(md5sum)
+    # gawk can't cope with enormous ints like $result would be, so stringify it first by prefixing a definite string
+    resultstring = "prefix"result
+
+    if (! (resultstring in chksum_array) )
+      { chksum_array[resultstring] = 0;  # This checksum hasn't been seen before, so add it to the array
+        OutputSuppression()              # and output the contents of the suppression
+      }
+ }
+
+ function OutputSuppression()
+ {
+  # A suppression is surrounded by '{' and '}'. Its data was stored line by line in the array  
+  print "{"  
+  for (n=1; n <= i; ++n)
+    { print supparray[n] }
+  print "}" 
+ }

+ 11 - 3
lua/scratch.lua

@@ -2,14 +2,16 @@ term = require "lsup.term"
 triple = require "lsup.triple"
 graph = require "lsup.graph"
 
+t1 = term.new_bnode()
+---[[
+t2 = term.new_iriref("urn:p:11")
+t3 = term.new_lit("123", "xsd:int")
+
 trp1 = triple.new (
     term.new_iriref("urn:s:1"),
     term.new_iriref("urn:p:1"),
     term.new_lit("hello", nil, "us-EN"))
 
-t1 = term.new_bnode()
-t2 = term.new_iriref("urn:p:11")
-t3 = term.new_lit("123", "xsd:int")
 trp2 = triple.new (t1, t2, t3)
 
 gr1 = graph.new()
@@ -18,3 +20,9 @@ ct = gr1:add(triples)
 print("Triples added: " .. ct)
 gr2 = graph.new()
 for i in gr1:lookup() do print(i) end
+
+lm = gr1:connections(t1, term.LINK_OUTBOUND)
+for t1, ts in lm:iter() do
+    for t2 in pairs(ts) do print(t1, t2) end
+end
+--]]

+ 7 - 91
lua/src/graph.c

@@ -1,5 +1,4 @@
 #include "lua_lsup.h"
-#include "stackdump.h"
 
 #define check_graph(L) \
     *(LSUP_Graph **)luaL_checkudata(L, 1, "LSUP.Graph")
@@ -140,7 +139,7 @@ static int l_graph_add (lua_State *L)
     LSUP_Graph *gr = check_graph (L);
     LOG_DEBUG ("Triples type: %s", lua_typename (L, lua_type (L, 2)));
     int rc;
-    LSUP_rc lsup_rc;
+    LSUP_rc lsup_rc= LSUP_NOACTION;
     size_t i = 0, ct = 0;
     LSUP_GraphIterator *it = LSUP_graph_add_init (gr);
 
@@ -174,6 +173,7 @@ static int graph_iter_next (lua_State *L)
     LSUP_Triple **spo_p = lua_newuserdatauv (L, sizeof (*spo_p), 1);
     luaL_getmetatable (L, "LSUP.Triple");
     lua_setmetatable (L, -2);
+    *spo_p = NULL;
 
     LSUP_rc rc = LSUP_graph_iter_next (it, spo_p);
 
@@ -218,72 +218,17 @@ static int l_graph_lookup (lua_State *L)
 
 static int graph_iter_gc (lua_State *L)
 {
-    LSUP_GraphIterator *it = *(LSUP_GraphIterator **)lua_touserdata (L, 1);
-    LSUP_graph_iter_free (it);
-}
+    LSUP_GraphIterator **it_p = lua_touserdata (L, 1);
 
+    if (UNLIKELY (!it_p || *it_p)) return 0;
 
-static int conn_iter_done (lua_State *L)
-{
-    LSUP_LinkMapIterator *it =
-        *(LSUP_LinkMapIterator **)lua_touserdata (L, lua_upvalueindex (1));
-    LSUP_link_map_iter_free (it);
+    LSUP_graph_iter_free (*it_p);
+    *it_p = NULL;
 
     return 0;
 }
 
 
-static int lmap_iter_next (lua_State *L)
-{
-    LSUP_LinkMapIterator *it =
-        *(LSUP_LinkMapIterator **)lua_touserdata (L, lua_upvalueindex (1));
-
-    LSUP_Term **link_p = (LSUP_Term **)lua_newuserdata (L, sizeof *link_p);
-    *link_p = NULL;
-    LSUP_TermSet *ts = NULL;
-    LSUP_rc rc = LSUP_link_map_next (it, link_p, &ts);
-
-    if (rc != LSUP_OK) {
-        if (rc == LSUP_END) {
-            LSUP_link_map_iter_free (it);
-            lua_pushnil (L);
-            lua_pushstring (L, "End of the loop.");
-            return 2;
-        }
-        else LUA_PCHECK (rc, "Error iterating through link map");
-    }
-
-    size_t i = 0;
-    LSUP_Term *conn = NULL;
-    lua_newtable (L);
-    while (LSUP_term_set_next (ts, &i, &conn)) {
-        LSUP_Term **conn_p = (LSUP_Term **)lua_newuserdata (L, sizeof *conn_p);
-        *conn_p = conn;
-        lua_pushboolean (L, true);
-        lua_rawset (L, -3);
-    }
-
-    return 2;
-}
-
-
-static int l_lmap_iter_init (lua_State *L)
-{
-    LSUP_LinkMap *lm = *(LSUP_LinkMap **)luaL_checkudata(L, 1, "LSUP.LinkMap");
-
-    LSUP_LinkMapIterator **lmit_p =
-        (LSUP_LinkMapIterator  **)lua_newuserdata (L, sizeof *lmit_p);
-    *lmit_p = LSUP_link_map_iter_new (lm);
-    luaL_getmetatable (L, "LSUP.LMapIterator");
-    lua_setmetatable (L, -2);
-    stackDump (L, "After allocating LMIter");
-
-    lua_pushcclosure (L, lmap_iter_next, 1);
-
-    return 1;
-}
-
-
 /** Returns a LinkMap that can be iterated over with iter().
  */
 static int l_graph_connections (lua_State *L)
@@ -291,6 +236,7 @@ static int l_graph_connections (lua_State *L)
     const LSUP_Graph *gr = check_graph (L);
     LSUP_Term *t = *(LSUP_Term **)luaL_checkudata (L, 2, "LSUP.Term");
     const LSUP_LinkType type = luaL_checkinteger (L, 3);
+    LOG_DEBUG ("Adding term for connections: @%p", *t);
 
     LSUP_LinkMap **lm_p =
         (LSUP_LinkMap **)lua_newuserdata (L, sizeof *lm_p);
@@ -302,24 +248,6 @@ static int l_graph_connections (lua_State *L)
 }
 
 
-static int link_map_gc (lua_State *L)
-{
-    LSUP_LinkMap *lm = *(LSUP_LinkMap **)lua_touserdata (L, 1);
-    LSUP_link_map_free (lm);
-
-    return 0;
-}
-
-
-static int lmap_iter_gc (lua_State *L)
-{
-    LSUP_LinkMapIterator *it = *(LSUP_LinkMapIterator **)lua_touserdata (L, 1);
-    LSUP_link_map_iter_free (it);
-
-    return 0;
-}
-
-
 static int l_graph_term_set (lua_State *L)
 {
     const LSUP_Graph *gr = check_graph (L);
@@ -389,10 +317,6 @@ static const luaL_Reg graph_lib_meth [] = {
 
 
 static const LEnumConst graph_enums[] = {
-    {"LINK_INBOUND", LSUP_LINK_INBOUND},
-    {"LINK_OUTBOUND", LSUP_LINK_OUTBOUND},
-    {"LINK_EDGE", LSUP_LINK_EDGE},
-
     {NULL, 0}
 };
 
@@ -410,14 +334,6 @@ int luaopen_lsup_graph (lua_State *L)
     lua_pushcfunction (L, graph_iter_gc);
     lua_setfield (L, -2, "__gc");
 
-    luaL_newmetatable (L, "LSUP.LinkMap");
-    lua_pushcfunction (L, link_map_gc);
-    lua_setfield (L, -2, "__gc");
-
-    luaL_newmetatable (L, "LSUP.LMapIterator");
-    lua_pushcfunction (L, lmap_iter_gc);
-    lua_setfield (L, -2, "__gc");
-
     /*
     // Getters table.
     lua_newtable (L);

+ 12 - 1
lua/src/stackdump.h

@@ -1,5 +1,11 @@
+#ifndef _STACK_DUMP_H
+#define _STACK_DUMP_H
+
+#ifdef DEBUG
+#define STACK_DUMP(...) stack_dump (__VA_ARGS__)
+
 static void
-stackDump (lua_State *L, const char *title)
+stack_dump (lua_State *L, const char *title)
 {
     // print out the scalar value or type of args on the stack 
     int i;
@@ -64,3 +70,8 @@ stackDump (lua_State *L, const char *title)
     }
     printf("]\n"); /* end the listing */
 }
+#else
+#define STACK_DUMP(...)
+#endif  // DEBUG
+
+#endif  // _STACK_DUMP_H

+ 122 - 2
lua/src/term.c

@@ -1,4 +1,5 @@
 #include "lua_lsup.h"
+#include "stackdump.h"
 
 #define check_term(L) \
     *(LSUP_Term **)luaL_checkudata(L, 1, "LSUP.Term")
@@ -136,8 +137,14 @@ static int l_term_equals (lua_State *L)
 
 static int l_term_gc (lua_State *L)
 {
-    LSUP_Term *t = check_term (L);
-    if (t) LSUP_term_free (t);
+    LSUP_Term **tp = luaL_checkudata(L, 1, "LSUP.Term");
+    // FIXME This is to prevent a double-free on shutdown.
+    // Must find the culprit instead.
+    if (UNLIKELY (!tp || !*tp)) return 0;
+    LOG_DEBUG ("Garbage collecting term @%p", *tp);
+
+    LSUP_term_free (*tp);
+    *tp = NULL;
 
     return 0;
 }
@@ -302,6 +309,102 @@ static int l_term_set_attr (lua_State *L)
 { return luaL_error (L, "Direct setting is not allowed for this type.", 2); }
 
 
+/*
+ * Ancillary types not directly created from Lua.
+ */
+
+static int lmap_iter_next (lua_State *L)
+{
+    LSUP_LinkMapIterator *it =
+        *(LSUP_LinkMapIterator **)lua_touserdata (L, lua_upvalueindex (1));
+
+    LSUP_Term **link_p = (LSUP_Term **)lua_newuserdata (L, sizeof *link_p);
+    *link_p = NULL;
+    luaL_getmetatable (L, "LSUP.Term");
+    lua_setmetatable (L, -2);
+
+    LSUP_TermSet *ts = NULL;
+    LSUP_Term *tmp = NULL;
+    LSUP_rc rc = LSUP_link_map_next (it, &tmp, &ts);
+
+    if (rc != LSUP_OK) {
+        if (rc == LSUP_END) {
+            lua_pushnil (L);
+            lua_pushstring (L, "End of the loop.");
+            return 2;
+        }
+        else LUA_PCHECK (rc, "Error iterating over link map");
+    }
+    *link_p = LSUP_term_copy (tmp);
+
+    size_t i = 0;
+    tmp = NULL;
+
+    lua_newtable (L);
+    while ((rc = LSUP_term_set_next (ts, &i, &tmp)) == LSUP_OK) {
+        LSUP_Term **t2_p = (LSUP_Term **)lua_newuserdata (L, sizeof *t2_p);
+        luaL_getmetatable (L, "LSUP.Term");
+        lua_setmetatable (L, -2);
+        *t2_p = LSUP_term_copy (tmp);
+
+        lua_pushboolean (L, true);
+        lua_rawset (L, -3);
+    }
+    LUA_PCHECK (rc, "Error iterating over term set");
+
+    // linked term + term set.
+    return 2;
+}
+
+
+/**
+ * Internally this function creates a LMapIterator, which is used as the
+ * upvalue for lmap_iter_next(). The iterator is garbage collected at the end
+ * of the iteration loop, the link map can be reused.
+ */
+static int l_lmap_iter_init (lua_State *L)
+{
+    STACK_DUMP (L, "beginning of LMap iter init fn");
+    LSUP_LinkMap *lm = *(LSUP_LinkMap **)luaL_checkudata(L, 1, "LSUP.LinkMap");
+
+    LSUP_LinkMapIterator **lmit_p =
+        (LSUP_LinkMapIterator  **)lua_newuserdata (L, sizeof *lmit_p);
+    *lmit_p = LSUP_link_map_iter_new (lm);
+    luaL_getmetatable (L, "LSUP.LMapIterator");
+    lua_setmetatable (L, -2);
+
+    lua_pushcclosure (L, lmap_iter_next, 1);
+    STACK_DUMP (L, "After pushing iter closure");
+
+    return 1;
+}
+
+
+static int link_map_gc (lua_State *L)
+{
+    LSUP_LinkMap **lm_p = lua_touserdata (L, 1);
+    LOG_DEBUG ("Garbage collecting link map @%p", *lm_p);
+    // FIXME This is to prevent a double-free on shutdown.
+    // Must find the culprit instead.
+    if (UNLIKELY (!lm_p || !*lm_p)) return 0;
+
+    LSUP_link_map_free (*lm_p);
+    *lm_p = NULL;
+
+    return 0;
+}
+
+
+static int lmap_iter_gc (lua_State *L)
+{
+    LSUP_LinkMapIterator *it = *(LSUP_LinkMapIterator **)lua_touserdata (L, 1);
+    LOG_DEBUG ("Garbage collecting link map iterator @%p", it);
+    LSUP_link_map_iter_free (it);
+
+    return 0;
+}
+
+
 /*
  * Library setup.
  */
@@ -364,6 +467,10 @@ static const LEnumConst term_enums[] = {
     {"TYPE_LT_LITERAL", LSUP_TERM_LT_LITERAL},
     {"TYPE_BNODE", LSUP_TERM_BNODE},
 
+    {"LINK_INBOUND", LSUP_LINK_INBOUND},
+    {"LINK_OUTBOUND", LSUP_LINK_OUTBOUND},
+    {"LINK_EDGE", LSUP_LINK_EDGE},
+
     {NULL, 0}
 };
 
@@ -393,6 +500,19 @@ int luaopen_lsup_term (lua_State *L)
     // Set getters table as a value for the Term metatable.
     lua_setfield (L, -2, "getters");
 
+    // Metatables for ancillary types.
+    luaL_newmetatable (L, "LSUP.LinkMap");
+    lua_pushvalue (L, -1);
+    lua_setfield (L, -2, "__index");
+    lua_pushcfunction (L, link_map_gc);
+    lua_setfield (L, -2, "__gc");
+    lua_pushcfunction (L, l_lmap_iter_init);
+    lua_setfield (L, -2, "iter");
+
+    luaL_newmetatable (L, "LSUP.LMapIterator");
+    lua_pushcfunction (L, lmap_iter_gc);
+    lua_setfield (L, -2, "__gc");
+
     luaL_newlib (L, term_lib_fn);
 
     // Module-level constants.

+ 661 - 0
lua/valgrind-lua-base.supp

@@ -0,0 +1,661 @@
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_set_prompt
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:expand_prompt
+   fun:rl_expand_prompt
+   fun:rl_set_prompt
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:strdup
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xrealloc
+   fun:expand_prompt
+   fun:rl_expand_prompt
+   fun:rl_set_prompt
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:strdup
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:_rl_reset_region_color
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:strdup
+   fun:update_getenv
+   fun:UnknownInlinedFun
+   fun:UnknownInlinedFun
+   fun:_nc_first_db
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:_rl_init_locale
+   fun:_rl_init_eightbit
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:_rl_read_init_file
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:realloc
+   fun:_nc_doalloc
+   fun:UnknownInlinedFun
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+   fun:main
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:parser_if
+   fun:UnknownInlinedFun
+   fun:rl_parse_and_bind
+   fun:_rl_read_init_file
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:_nc_home_terminfo
+   fun:UnknownInlinedFun
+   fun:_nc_first_db
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:__tsearch
+   fun:tsearch
+   fun:tparm_setup.lto_priv.0
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:UnknownInlinedFun
+   fun:_nc_first_db
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:realloc
+   fun:_nc_doalloc
+   fun:_nc_read_termtype
+   fun:_nc_read_file_entry
+   fun:_nc_read_tic_entry.constprop.0
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:copy_termtype
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:UnknownInlinedFun
+   fun:_nc_first_db
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:strdup
+   fun:tparm_setup.lto_priv.0
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:_nc_tparm_analyze
+   fun:tparm_setup.lto_priv.0
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:tparm_setup.lto_priv.0
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:_nc_read_termtype
+   fun:_nc_read_file_entry
+   fun:_nc_read_tic_entry.constprop.0
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:_nc_read_termtype
+   fun:_nc_read_file_entry
+   fun:_nc_read_tic_entry.constprop.0
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:copy_termtype
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xrealloc
+   fun:realloc_line
+   fun:init_line_structures
+   fun:rl_redisplay
+   fun:readline_internal_setup
+   fun:UnknownInlinedFun
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:init_line_structures
+   fun:rl_redisplay
+   fun:readline_internal_setup
+   fun:UnknownInlinedFun
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:realloc
+   fun:xrealloc
+   fun:rl_add_funmap_entry
+   fun:UnknownInlinedFun
+   fun:rl_initialize_funmap
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_add_funmap_entry
+   fun:UnknownInlinedFun
+   fun:rl_initialize_funmap
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_make_bare_keymap
+   fun:rl_generic_bind
+   fun:UnknownInlinedFun
+   fun:rl_bind_keyseq_if_unbound_in_map
+   fun:bind_termcap_arrow_keys
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_make_bare_keymap
+   fun:rl_generic_bind
+   fun:UnknownInlinedFun
+   fun:rl_bind_keyseq_if_unbound_in_map
+   fun:bind_arrow_keys_internal
+   fun:UnknownInlinedFun
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:_nc_build_names.lto_priv.0
+   fun:_nc_find_type_entry
+   fun:tgetstr_sp
+   fun:UnknownInlinedFun
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_make_bare_keymap
+   fun:rl_generic_bind
+   fun:UnknownInlinedFun
+   fun:rl_bind_keyseq_if_unbound_in_map
+   fun:UnknownInlinedFun
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_make_bare_keymap
+   fun:rl_generic_bind
+   fun:rl_parse_and_bind
+   fun:_rl_read_init_file
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+}

+ 712 - 0
lua/valgrind-lua.supp

@@ -0,0 +1,712 @@
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_set_prompt
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:expand_prompt
+   fun:rl_expand_prompt
+   fun:rl_set_prompt
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:strdup
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xrealloc
+   fun:expand_prompt
+   fun:rl_expand_prompt
+   fun:rl_set_prompt
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:strdup
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:_rl_reset_region_color
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:strdup
+   fun:update_getenv
+   fun:UnknownInlinedFun
+   fun:UnknownInlinedFun
+   fun:_nc_first_db
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:_rl_init_locale
+   fun:_rl_init_eightbit
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:_rl_read_init_file
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:realloc
+   fun:_nc_doalloc
+   fun:UnknownInlinedFun
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+   fun:main
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:parser_if
+   fun:UnknownInlinedFun
+   fun:rl_parse_and_bind
+   fun:_rl_read_init_file
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:_nc_home_terminfo
+   fun:UnknownInlinedFun
+   fun:_nc_first_db
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:__tsearch
+   fun:tsearch
+   fun:tparm_setup.lto_priv.0
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: indirect
+   fun:calloc
+   obj:*
+   obj:*
+   obj:*
+   fun:luaD_precall
+   fun:luaV_execute
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+   fun:docall
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: indirect
+   fun:malloc
+   obj:*
+   obj:*
+   obj:*
+   fun:luaD_precall
+   fun:luaV_execute
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+   fun:docall
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:UnknownInlinedFun
+   fun:_nc_first_db
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:realloc
+   fun:_nc_doalloc
+   fun:_nc_read_termtype
+   fun:_nc_read_file_entry
+   fun:_nc_read_tic_entry.constprop.0
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:copy_termtype
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:UnknownInlinedFun
+   fun:_nc_first_db
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:strdup
+   fun:tparm_setup.lto_priv.0
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:_nc_tparm_analyze
+   fun:tparm_setup.lto_priv.0
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:tparm_setup.lto_priv.0
+   fun:_nc_tiparm
+   fun:set_attribute_9.isra.0
+   fun:_nc_trim_sgr0
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   obj:*
+   obj:*
+   fun:luaD_precall
+   fun:luaV_execute
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+   fun:docall
+   fun:pmain
+   fun:luaD_precall
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+   fun:lua_pcallk
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:_nc_read_termtype
+   fun:_nc_read_file_entry
+   fun:_nc_read_tic_entry.constprop.0
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:_nc_read_termtype
+   fun:_nc_read_file_entry
+   fun:_nc_read_tic_entry.constprop.0
+   fun:_nc_read_entry2
+   fun:_nc_setup_tinfo
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:copy_termtype
+   fun:_nc_setupterm
+   fun:tgetent_sp
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xrealloc
+   fun:realloc_line
+   fun:init_line_structures
+   fun:rl_redisplay
+   fun:readline_internal_setup
+   fun:UnknownInlinedFun
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:init_line_structures
+   fun:rl_redisplay
+   fun:readline_internal_setup
+   fun:UnknownInlinedFun
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:realloc
+   fun:xrealloc
+   fun:rl_add_funmap_entry
+   fun:UnknownInlinedFun
+   fun:rl_initialize_funmap
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+   fun:luaD_pcall
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_add_funmap_entry
+   fun:UnknownInlinedFun
+   fun:rl_initialize_funmap
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+   fun:luaD_rawrunprotected
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_make_bare_keymap
+   fun:rl_generic_bind
+   fun:UnknownInlinedFun
+   fun:rl_bind_keyseq_if_unbound_in_map
+   fun:bind_termcap_arrow_keys
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_make_bare_keymap
+   fun:rl_generic_bind
+   fun:UnknownInlinedFun
+   fun:rl_bind_keyseq_if_unbound_in_map
+   fun:bind_arrow_keys_internal
+   fun:UnknownInlinedFun
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:calloc
+   fun:_nc_build_names.lto_priv.0
+   fun:_nc_find_type_entry
+   fun:tgetstr_sp
+   fun:UnknownInlinedFun
+   fun:_rl_init_terminal_io
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_make_bare_keymap
+   fun:rl_generic_bind
+   fun:UnknownInlinedFun
+   fun:rl_bind_keyseq_if_unbound_in_map
+   fun:UnknownInlinedFun
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+   fun:luaD_callnoyield
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:xmalloc
+   fun:rl_make_bare_keymap
+   fun:rl_generic_bind
+   fun:rl_parse_and_bind
+   fun:_rl_read_init_file
+   fun:UnknownInlinedFun
+   fun:rl_initialize
+   fun:readline
+   fun:pushline
+   fun:doREPL
+   fun:pmain
+   fun:luaD_precall
+}

+ 0 - 1
src/graph.c

@@ -703,7 +703,6 @@ LSUP_graph_connections (
         pos1 = TRP_POS_P;
         pos2 = TRP_POS_S;
     } else {
-        // Very unlikely.
         log_error ("Invalid connection type: %d", type);
         return NULL;
     }

+ 2 - 1
src/term.c

@@ -55,7 +55,7 @@ struct link_map_iter {
     const LSUP_LinkMap *map;        ///< Link map to iterate.
     size_t              i;          ///< Linking term loop cursor.
     size_t              j;          ///< Term set loop cursor.
-    Link *              link;       ///< Current link being retrieved.
+    const Link *        link;       ///< Current link being retrieved.
 };
 
 
@@ -693,6 +693,7 @@ LSUP_link_map_iter_new (const LSUP_LinkMap *lmap)
 }
 
 
+// This leaves the link and link map references intact.
 void
 LSUP_link_map_iter_free (LSUP_LinkMapIterator *it) { free (it); }