Commit 0937d8d2 authored by Logan Hanks's avatar Logan Hanks Committed by Han-Wen Nienhuys

Fix memory leak when unregistering most recently opened file handle.

parent 31748207
...@@ -99,7 +99,11 @@ func (m *fileSystemMount) unregisterFileHandle(handle uint64, node *Inode) *open ...@@ -99,7 +99,11 @@ func (m *fileSystemMount) unregisterFileHandle(handle uint64, node *Inode) *open
} }
l := len(node.openFiles) l := len(node.openFiles)
if idx == l-1 {
node.openFiles[idx] = nil
} else {
node.openFiles[idx] = node.openFiles[l-1] node.openFiles[idx] = node.openFiles[l-1]
}
node.openFiles = node.openFiles[:l-1] node.openFiles = node.openFiles[:l-1]
node.openFilesMutex.Unlock() node.openFilesMutex.Unlock()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment