Skip to content

Commit

Permalink
Add guard against nullptr dereference in ConfigCatClient::close
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Apr 2, 2024
1 parent c8f458d commit 34cc2e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/configcatclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ std::shared_ptr<ConfigCatClient> ConfigCatClient::get(const std::string& sdkKey,
}

void ConfigCatClient::close(const std::shared_ptr<ConfigCatClient>& client) {
if (client)
{
lock_guard<mutex> lock(instancesMutex);

Expand All @@ -78,9 +79,10 @@ void ConfigCatClient::close(const std::shared_ptr<ConfigCatClient>& client) {
return;
}
}

LOG_ERROR_OBJECT(client->logger, 0) << "Client does not exist.";
}

LOG_ERROR_OBJECT(client->logger, 0) << "Client does not exist.";
assert(false);
}

Expand Down

0 comments on commit 34cc2e4

Please sign in to comment.