Diff

util/xmppstream.lua @ 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
parent 9020:19e51d8f8947
child 10093:1266a63ba567
child 11543:63fd4c8465fb
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;