Changeset

9071:db61e33bbd41

util.xmppstream: Explicitly release old parser object on stream reset
author Matthew Wild <mwild1@gmail.com>
date Tue, 31 Jul 2018 15:42:45 +0100
parents 9070:21730a3642fe
children 9072:9603a6a1ec85
files util/xmppstream.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/xmppstream.lua	Mon Jul 30 15:13:54 2018 +0100
+++ b/util/xmppstream.lua	Tue Jul 31 15:42:45 2018 +0100
@@ -278,10 +278,15 @@
 			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;