aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm/mime.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lualib/rspamadm/mime.lua')
-rw-r--r--lualib/rspamadm/mime.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua
index 6294f373f..8bd2478c8 100644
--- a/lualib/rspamadm/mime.lua
+++ b/lualib/rspamadm/mime.lua
@@ -266,6 +266,7 @@ end
local function extract_handler(opts)
local out_elts = {}
+ local tasks = {}
local process_func
if opts.words then
@@ -415,11 +416,12 @@ local function extract_handler(opts)
end
table.insert(out_elts[fname], "")
-
- task:destroy() -- No automatic dtor
+ table.insert(tasks, task)
end
print_elts(out_elts, opts, process_func)
+ -- To avoid use after free we postpone tasks destruction
+ for _,task in ipairs(tasks) do task:destroy() end
end
local function stat_handler(opts)