Merge branch 'backport-fix-read-after-free' into release
This commit is contained in:
commit
a03dbf1043
|
@ -339,16 +339,24 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
||||||
// The value is transformed if it is a filepath for example, so
|
// The value is transformed if it is a filepath for example, so
|
||||||
// we can't compare whether the value is already in the cache until
|
// we can't compare whether the value is already in the cache until
|
||||||
// after we call AddCacheEntry.
|
// after we call AddCacheEntry.
|
||||||
const char *cachedValue =
|
bool haveValue = false;
|
||||||
this->CacheManager->GetCacheValue(var.c_str());
|
std::string cachedValue;
|
||||||
|
if(this->WarnUnusedCli)
|
||||||
|
{
|
||||||
|
if(const char *v = this->CacheManager->GetCacheValue(var.c_str()))
|
||||||
|
{
|
||||||
|
haveValue = true;
|
||||||
|
cachedValue = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
|
this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
|
||||||
"No help, variable specified on the command line.", type);
|
"No help, variable specified on the command line.", type);
|
||||||
|
|
||||||
if(this->WarnUnusedCli)
|
if(this->WarnUnusedCli)
|
||||||
{
|
{
|
||||||
if (!cachedValue
|
if (!haveValue ||
|
||||||
|| strcmp(this->CacheManager->GetCacheValue(var.c_str()),
|
cachedValue != this->CacheManager->GetCacheValue(var.c_str()))
|
||||||
cachedValue) != 0)
|
|
||||||
{
|
{
|
||||||
this->WatchUnusedCli(var.c_str());
|
this->WatchUnusedCli(var.c_str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue