util.xmppstream: Explicitly release old parser object on stream reset

This commit is contained in:
Matthew Wild 2018-07-31 15:42:45 +01:00
parent 5c58943143
commit 93c75744ca

View file

@ -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;