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
}
l := len(node.openFiles)
node.openFiles[idx] = node.openFiles[l-1]
if idx == l-1 {
node.openFiles[idx] = nil
} else {
node.openFiles[idx] = node.openFiles[l-1]
}
node.openFiles = node.openFiles[:l-1]
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