Fix reference leak for negative dirents
PiperOrigin-RevId: 200306715 Change-Id: I7c80059c77ebd3d9a5d7d48b05c8e7a597f10850
This commit is contained in:
parent
c2b3f04d1c
commit
ba426f7782
|
@ -1257,6 +1257,15 @@ func (d *Dirent) destroy() {
|
||||||
|
|
||||||
// Drop all weak references.
|
// Drop all weak references.
|
||||||
for _, w := range d.children {
|
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()
|
w.Drop()
|
||||||
}
|
}
|
||||||
d.children = nil
|
d.children = nil
|
||||||
|
|
Loading…
Reference in New Issue