nfs4: FileSystem::~FileSystem() make sure fServer is valid

This commit is contained in:
Pawel Dziepak 2013-10-29 19:16:25 +01:00
parent 17381b7f37
commit f87dd6dceb

View File

@ -30,6 +30,7 @@ FileSystem::FileSystem(const MountConfiguration& configuration)
fNamedAttrs(true),
fPath(NULL),
fRoot(NULL),
fServer(NULL),
fId(1),
fConfiguration(configuration)
{
@ -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);