Correctly handle the case when no ResourceLeakTracker was created for derived pooled buffers. This was missed in c2f4daa739
This commit is contained in:
parent
fc1cdc991e
commit
13a8ebade4
@ -137,16 +137,15 @@ class SimpleLeakAwareByteBuf extends WrappedByteBuf {
|
|||||||
ByteBuf unwrappedDerived = unwrapSwapped(derived);
|
ByteBuf unwrappedDerived = unwrapSwapped(derived);
|
||||||
|
|
||||||
if (unwrappedDerived instanceof AbstractPooledDerivedByteBuf) {
|
if (unwrappedDerived instanceof AbstractPooledDerivedByteBuf) {
|
||||||
|
// Update the parent to point to this buffer so we correctly close the ResourceLeakTracker.
|
||||||
|
((AbstractPooledDerivedByteBuf) unwrappedDerived).parent(this);
|
||||||
|
|
||||||
ResourceLeakTracker<ByteBuf> newLeak = AbstractByteBuf.leakDetector.track(derived);
|
ResourceLeakTracker<ByteBuf> newLeak = AbstractByteBuf.leakDetector.track(derived);
|
||||||
if (newLeak == null) {
|
if (newLeak == null) {
|
||||||
// No leak detection, just return the derived buffer.
|
// No leak detection, just return the derived buffer.
|
||||||
return derived;
|
return derived;
|
||||||
}
|
}
|
||||||
ByteBuf leakAwareBuf = newLeakAwareByteBuf(derived, newLeak);
|
return newLeakAwareByteBuf(derived, newLeak);
|
||||||
|
|
||||||
// Update the parent to point to this buffer.
|
|
||||||
((AbstractPooledDerivedByteBuf) unwrappedDerived).parent(this);
|
|
||||||
return leakAwareBuf;
|
|
||||||
}
|
}
|
||||||
return newSharedLeakAwareByteBuf(derived);
|
return newSharedLeakAwareByteBuf(derived);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user