commit f3bcd7d: [Minor] Do not return raw tables as they might be uninitialized

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Jul 7 11:07:28 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-07-07 12:02:55 +0100
URL: https://github.com/rspamd/rspamd/commit/f3bcd7d1b7fcccb3de4a3857dfd3d70229b81eca

[Minor] Do not return raw tables as they might be uninitialized

---
 lualib/lua_settings.lua | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/lualib/lua_settings.lua b/lualib/lua_settings.lua
index fb1a70217..67a33bb58 100644
--- a/lualib/lua_settings.lua
+++ b/lualib/lua_settings.lua
@@ -211,9 +211,24 @@ end
 
 
 exports.settings_by_id = settings_by_id
-exports.all_settings = known_ids
-exports.all_symbols = all_symbols
+exports.all_settings = function()
+  if not post_init_performed then
+    register_settings_cb()
+  end
+  return known_ids
+end
+exports.all_symbols = function()
+  if not post_init_performed then
+    register_settings_cb()
+  end
+  return all_symbols
+end
 -- What is enabled when no settings are there
-exports.default_symbols = default_symbols
+exports.default_symbols = function()
+  if not post_init_performed then
+    register_settings_cb()
+  end
+  return default_symbols
+end
 
 return exports
\ No newline at end of file


More information about the Commits mailing list