release ext packet if patching fails (#4142)

This commit is contained in:
Raja Subramanian
2025-12-10 12:09:49 +05:30
committed by GitHub
parent dd598ef23f
commit 037cb9062f
+4 -3
View File
@@ -543,13 +543,14 @@ func (b *Buffer) ReadExtended(buf []byte) (*ExtPacket, error) {
}
if b.extPackets.Len() > 0 {
ep := b.extPackets.PopFront()
ep = b.patchExtPacket(ep, buf)
if ep == nil {
patched := b.patchExtPacket(ep, buf)
if patched == nil {
b.ReleaseExtPacket(ep)
continue
}
b.Unlock()
return ep, nil
return patched, nil
}
b.readCond.Wait()
}