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
@@ -30,6 +30,7 @@ FileSystem::FileSystem(const MountConfiguration& configuration)
fNamedAttrs(true), fNamedAttrs(true),
fPath(NULL), fPath(NULL),
fRoot(NULL), fRoot(NULL),
fServer(NULL),
fId(1), fId(1),
fConfiguration(configuration) fConfiguration(configuration)
{ {
@@ -44,9 +45,12 @@ FileSystem::FileSystem(const MountConfiguration& configuration)
FileSystem::~FileSystem() FileSystem::~FileSystem()
{ {
NFS4Server* server = reinterpret_cast<NFS4Server*>(fServer->PrivateData()); if (fServer != NULL) {
if (server != NULL) NFS4Server* server
server->RemoveFileSystem(this); = reinterpret_cast<NFS4Server*>(fServer->PrivateData());
if (server != NULL)
server->RemoveFileSystem(this);
}
mutex_destroy(&fDelegationLock); mutex_destroy(&fDelegationLock);
mutex_destroy(&fOpenLock); mutex_destroy(&fOpenLock);