Add central Lua shutdown function and use it
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 14 Jan 2009 13:18:25 +0000 (15:18 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 14 Jan 2009 13:18:25 +0000 (15:18 +0200)
- makes sure lua garbage collect runs
- memory used by lua gets freed

lib/rpmliblua.c
lib/rpmliblua.h
lib/rpmrc.c

index e67fc2d..6876d2f 100644 (file)
@@ -35,4 +35,10 @@ void rpmLuaInit(void)
     return;
 }
 
+void rpmLuaFree(void)
+{
+    rpmlua lua = rpmluaGetGlobalState();
+    rpmluaFree(lua);
+}
+
 #endif /* WITH_LUA */
index 17578ee..cc15ae9 100644 (file)
@@ -4,4 +4,7 @@
 /* Initialize Lua subsystem & register all our extensions */
 void rpmLuaInit(void);
 
+/* Shutdown Lua subsystem */
+void rpmLuaFree(void);
+
 #endif /* _RPMLIBLUA_H */
index 0877a87..f478a24 100644 (file)
@@ -1606,6 +1606,9 @@ void rpmFreeRpmrc(void)
 
     /* XXX doesn't really belong here but... */
     rpmFreeCrypto();
+#ifdef WITH_LUA
+    rpmLuaFree();
+#endif
 
     return;
 }