mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix reference leak for negative dirents
PiperOrigin-RevId: 200306715 Change-Id: I7c80059c77ebd3d9a5d7d48b05c8e7a597f10850
This commit is contained in:
@@ -1257,6 +1257,15 @@ func (d *Dirent) destroy() {
|
||||
|
||||
// Drop all weak references.
|
||||
for _, w := range d.children {
|
||||
if c := w.Get(); c != nil {
|
||||
if c.(*Dirent).IsNegative() {
|
||||
// The parent holds both weak and strong refs in the case of
|
||||
// negative dirents.
|
||||
c.DecRef()
|
||||
}
|
||||
// Drop the reference we just acquired in WeakRef.Get.
|
||||
c.DecRef()
|
||||
}
|
||||
w.Drop()
|
||||
}
|
||||
d.children = nil
|
||||
|
||||
Reference in New Issue
Block a user