mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-22 06:57:51 +00:00
vfs server: fix dangling alloc on watch failure
This patch reverts the vfs-watch-handle creation whenever the subsequent allocation of the VFS server's 'Watch' object fails. This can happen when the session RAM or cap quota is depleted. Fixes #4472
This commit is contained in:
parent
df1767b784
commit
79279b93fb
@ -590,10 +590,16 @@ class Vfs_server::Session_component : private Session_resources,
|
||||
throw Out_of_caps();
|
||||
}
|
||||
|
||||
Node &node = *new (_alloc)
|
||||
Watch_node(_node_space, path_str, *vfs_handle, *this);
|
||||
try {
|
||||
Node &node = *new (_alloc)
|
||||
Watch_node(_node_space, path_str, *vfs_handle, *this);
|
||||
|
||||
return Watch_handle { node.id().value };
|
||||
return Watch_handle { node.id().value };
|
||||
}
|
||||
catch (...) {
|
||||
vfs_handle->close();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void close(Node_handle handle) override
|
||||
|
Loading…
Reference in New Issue
Block a user