Skip to content

Commit

Permalink
Merge pull request #2262 from brave/fix_4152
Browse files Browse the repository at this point in the history
Issue 4152: findFirstPartyHosts returns a value on the heap. Deleting it to avoid leaks
  • Loading branch information
NejcZdovc authored Apr 18, 2019
2 parents 7cdda52 + 80c221d commit d92d2b3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ std::vector<std::string> TrackingProtectionService::GetThirdPartyHosts(
}
}

std::string thirdPartyHosts =
char* thirdPartyHosts =
tracking_protection_client_->findFirstPartyHosts(base_host.c_str());
std::vector<std::string> hosts;
if (!thirdPartyHosts.empty()) {
if (nullptr != thirdPartyHosts) {
std::string strThirdPartyHosts = thirdPartyHosts;
size_t iPos = strThirdPartyHosts.find(",");
while (iPos != std::string::npos) {
Expand All @@ -335,6 +335,7 @@ std::vector<std::string> TrackingProtectionService::GetThirdPartyHosts(
if (0 != strThirdPartyHosts.length()) {
hosts.push_back(strThirdPartyHosts);
}
delete []thirdPartyHosts;
}

{
Expand Down

0 comments on commit d92d2b3

Please sign in to comment.