aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-07-31 15:42:45 +0100
committerMatthew Wild <mwild1@gmail.com>2018-07-31 15:42:45 +0100
commit93c75744ca64d5fe5f80454d8a7eb1f07f99faa5 (patch)
tree7f75ebf16e94dba2150521af7cf25f5662c9c6c5
parent5c58943143649782f3ed7c584959194f0c47c0dd (diff)
downloadprosody-93c75744ca64d5fe5f80454d8a7eb1f07f99faa5.tar.gz
prosody-93c75744ca64d5fe5f80454d8a7eb1f07f99faa5.zip
util.xmppstream: Explicitly release old parser object on stream reset
-rw-r--r--util/xmppstream.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua
index f245afbf..58cbd18e 100644
--- a/util/xmppstream.lua
+++ b/util/xmppstream.lua
@@ -278,10 +278,15 @@ local function new(session, stream_callbacks, stanza_size_limit)
if lxp_supports_bytecount then
n_outstanding_bytes = n_outstanding_bytes + #data;
end
- local ok, err = parse(parser, data);
+ local _parser = parser;
+ local ok, err = parse(_parser, data);
if lxp_supports_bytecount and n_outstanding_bytes > stanza_size_limit then
return nil, "stanza-too-large";
end
+ if parser ~= _parser then
+ _parser:parse();
+ _parser:close();
+ end
return ok, err;
end,
set_session = meta.set_session;