bindfs: Volume: Don't leak source directory vnode reference
This commit is contained in:
@@ -33,6 +33,7 @@ Volume::Volume(fs_volume* fsVolume)
|
|||||||
:
|
:
|
||||||
fFSVolume(fsVolume),
|
fFSVolume(fsVolume),
|
||||||
fSourceFSVolume(NULL),
|
fSourceFSVolume(NULL),
|
||||||
|
fSourceVnode(NULL),
|
||||||
fRootNode(NULL)
|
fRootNode(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -40,6 +41,8 @@ Volume::Volume(fs_volume* fsVolume)
|
|||||||
|
|
||||||
Volume::~Volume()
|
Volume::~Volume()
|
||||||
{
|
{
|
||||||
|
if (fSourceVnode != NULL)
|
||||||
|
vfs_put_vnode(fSourceVnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -57,13 +60,12 @@ Volume::Mount(const char* parameterString)
|
|||||||
RETURN_ERROR(B_BAD_VALUE);
|
RETURN_ERROR(B_BAD_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct vnode* sourceVnode;
|
status_t error = vfs_get_vnode_from_path(source, true, &fSourceVnode);
|
||||||
status_t error = vfs_get_vnode_from_path(source, true, &sourceVnode);
|
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
RETURN_ERROR(error);
|
RETURN_ERROR(error);
|
||||||
if (sourceVnode == NULL)
|
if (fSourceVnode == NULL)
|
||||||
RETURN_ERROR(B_ENTRY_NOT_FOUND);
|
RETURN_ERROR(B_ENTRY_NOT_FOUND);
|
||||||
fs_vnode* sourceFSNode = vfs_fsnode_for_vnode(sourceVnode);
|
fs_vnode* sourceFSNode = vfs_fsnode_for_vnode(fSourceVnode);
|
||||||
fSourceFSVolume = volume_for_vnode(sourceFSNode);
|
fSourceFSVolume = volume_for_vnode(sourceFSNode);
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class Node;
|
class Node;
|
||||||
|
struct vnode;
|
||||||
|
|
||||||
|
|
||||||
class Volume {
|
class Volume {
|
||||||
@@ -41,6 +42,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
fs_volume* fFSVolume;
|
fs_volume* fFSVolume;
|
||||||
fs_volume* fSourceFSVolume;
|
fs_volume* fSourceFSVolume;
|
||||||
|
vnode* fSourceVnode;
|
||||||
Node* fRootNode;
|
Node* fRootNode;
|
||||||
|
|
||||||
fs_vnode_ops fVnodeOps;
|
fs_vnode_ops fVnodeOps;
|
||||||
|
|||||||
Reference in New Issue
Block a user