From bbd90cc04bfe774d435fa42f56cba6facb35b4c7 Mon Sep 17 00:00:00 2001 From: Martin Dosch Date: Wed, 27 Mar 2024 21:12:42 +0100 Subject: [PATCH] Copy token in nextStart function. See https://github.com/xmppo/go-xmpp/commit/bc81053dbcc048fbd2ec60ca4cdf9d2ab4f34834#commitcomment-140301890 and https://github.com/xmppo/go-xmpp/commit/bc81053dbcc048fbd2ec60ca4cdf9d2ab4f34834#commitcomment-140303962 --- xmpp.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xmpp.go b/xmpp.go index d423278..43199f7 100644 --- a/xmpp.go +++ b/xmpp.go @@ -1466,11 +1466,12 @@ type rosterItem struct { func (c *Client) nextStart() (xml.StartElement, error) { for { c.nextMutex.Lock() - t, err := c.p.Token() - if err != nil || t == nil { + to, err := c.p.Token() + if err != nil || to == nil { c.nextMutex.Unlock() return xml.StartElement{}, err } + t := xml.CopyToken(to) switch t := t.(type) { case xml.StartElement: c.nextMutex.Unlock()