about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-10 09:56:37 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-03-10 09:56:37 -0800
commit04a65e05f843377104543b5ee2abcb16d2932bbc (patch)
tree6bf9fd5ec576cde763a8f8dc9427740832173b2c /src
parent0fa83e1d94055d73fb656cf1db44f1937c7bec2a (diff)
downloadteliva-04a65e05f843377104543b5ee2abcb16d2932bbc.tar.gz
leak check
Diffstat (limited to 'src')
-rw-r--r--src/teliva.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/teliva.c b/src/teliva.c
index 50ab015..6bcdf7f 100644
--- a/src/teliva.c
+++ b/src/teliva.c
@@ -1202,6 +1202,7 @@ static int load_definitions(lua_State* L) {
 
 static int run_tests(lua_State* L) {
   clear();
+  int oldtop = lua_gettop(L);
   lua_pushinteger(L, 0);
   lua_setglobal(L, "teliva_num_test_failures");
   lua_pushnil(L);
@@ -1239,6 +1240,11 @@ static int run_tests(lua_State* L) {
   lua_getglobal(L, "teliva_num_test_failures");
   int num_failures = lua_tointeger(L, -1);
   lua_pop(L, 1);
+  if (lua_gettop(L) != oldtop) {
+    endwin();
+    printf("render_recent_changes: memory leak %d -> %d\n", oldtop, lua_gettop(L));
+    exit(1);
+  }
   if (num_failures == 0) return 0;
   if (num_failures == 1)
     addstr("1 failure");