From 84f4ead3d22b612d0dbf21c78a73d91b6327be65 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 31 Jul 2018 15:42:45 +0100 Subject: util.xmppstream: Explicitly release old parser object on stream reset --- util/xmppstream.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'util/xmppstream.lua') 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; -- cgit v1.2.3