Skip to content

Commit

Permalink
Kext: Check fSharedMemory and fDataQueue before trying to release the…
Browse files Browse the repository at this point in the history
…m in terminate()
  • Loading branch information
russellhancox committed Apr 9, 2015
1 parent 49b169e commit cbb786c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Source/santa-driver/SantaDriverClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ bool SantaDriverClient::start(IOService *provider) {

fSDM = fProvider->GetDecisionManager();

if (!fSDM) return false;

return true;
}

void SantaDriverClient::stop(IOService *provider) {
super::stop(provider);

fProvider = NULL;
}

Expand All @@ -61,11 +62,15 @@ bool SantaDriverClient::terminate(IOOptionBits options) {
fSDM->DisconnectClient();
LOGI("Client disconnected.");

fSharedMemory->release();
fSharedMemory = NULL;
if (fSharedMemory) {
fSharedMemory->release();
fSharedMemory = NULL;
}

fDataQueue->release();
fDataQueue = NULL;
if (fDataQueue) {
fDataQueue->release();
fDataQueue = NULL;
}

if (fProvider && fProvider->isOpen(this)) fProvider->close(this);

Expand Down

0 comments on commit cbb786c

Please sign in to comment.