Skip to content

Commit

Permalink
nfs4: FileSystem::~FileSystem() make sure fServer is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
pdziepak committed Oct 29, 2013
1 parent 17381b7 commit f87dd6d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp
Expand Up @@ -30,6 +30,7 @@ FileSystem::FileSystem(const MountConfiguration& configuration)
fNamedAttrs(true),
fPath(NULL),
fRoot(NULL),
fServer(NULL),
fId(1),
fConfiguration(configuration)
{
Expand All @@ -44,9 +45,12 @@ FileSystem::FileSystem(const MountConfiguration& configuration)

FileSystem::~FileSystem()
{
NFS4Server* server = reinterpret_cast<NFS4Server*>(fServer->PrivateData());
if (server != NULL)
server->RemoveFileSystem(this);
if (fServer != NULL) {
NFS4Server* server
= reinterpret_cast<NFS4Server*>(fServer->PrivateData());
if (server != NULL)
server->RemoveFileSystem(this);
}

mutex_destroy(&fDelegationLock);
mutex_destroy(&fOpenLock);
Expand Down

0 comments on commit f87dd6d

Please sign in to comment.