release ext packet if patching fails (#4142)
This commit is contained in:
@@ -543,13 +543,14 @@ func (b *Buffer) ReadExtended(buf []byte) (*ExtPacket, error) {
|
|||||||
}
|
}
|
||||||
if b.extPackets.Len() > 0 {
|
if b.extPackets.Len() > 0 {
|
||||||
ep := b.extPackets.PopFront()
|
ep := b.extPackets.PopFront()
|
||||||
ep = b.patchExtPacket(ep, buf)
|
patched := b.patchExtPacket(ep, buf)
|
||||||
if ep == nil {
|
if patched == nil {
|
||||||
|
b.ReleaseExtPacket(ep)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
b.Unlock()
|
b.Unlock()
|
||||||
return ep, nil
|
return patched, nil
|
||||||
}
|
}
|
||||||
b.readCond.Wait()
|
b.readCond.Wait()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user