summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-20 10:16:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-03-20 10:17:00 (GMT)
commit94139ac58e2a4b1c4e3360b6d0da31ba9ba23c3c (patch)
tree6b5c0327c0f54ad107e5057894486c1b54be5aba /Source/cmGlobalGenerator.cxx
parent9bbea2344b058734047b0c889b2a6dae13c85cec (diff)
parent8affe9aa336b873e9c8e40ec5911ffe23c2ef03a (diff)
downloadCMake-94139ac58e2a4b1c4e3360b6d0da31ba9ba23c3c.zip
CMake-94139ac58e2a4b1c4e3360b6d0da31ba9ba23c3c.tar.gz
CMake-94139ac58e2a4b1c4e3360b6d0da31ba9ba23c3c.tar.bz2
Merge topic 'export-repeat'
8affe9aa33 export: Fix use-after-free on multiple calls overwriting same FILE Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4494
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx19
1 files changed, 9 insertions, 10 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0b9a3e5..0e10734 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -262,17 +262,16 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
}
}
-void cmGlobalGenerator::AddBuildExportSet(
- std::unique_ptr<cmExportBuildFileGenerator> gen)
+void cmGlobalGenerator::AddBuildExportSet(cmExportBuildFileGenerator* gen)
{
- this->BuildExportSets[gen->GetMainExportFileName()] = std::move(gen);
+ this->BuildExportSets[gen->GetMainExportFileName()] = gen;
}
void cmGlobalGenerator::AddBuildExportExportSet(
- std::unique_ptr<cmExportBuildFileGenerator> gen)
+ cmExportBuildFileGenerator* gen)
{
- this->BuildExportExportSets[gen->GetMainExportFileName()] = gen.get();
- this->AddBuildExportSet(std::move(gen));
+ this->BuildExportExportSets[gen->GetMainExportFileName()] = gen;
+ this->AddBuildExportSet(gen);
}
bool cmGlobalGenerator::GenerateImportFile(const std::string& file)
@@ -283,7 +282,7 @@ bool cmGlobalGenerator::GenerateImportFile(const std::string& file)
if (!this->ConfigureDoneCMP0026AndCMP0024) {
for (const auto& m : this->Makefiles) {
- m->RemoveExportBuildFileGeneratorCMP0024(it->second.get());
+ m->RemoveExportBuildFileGeneratorCMP0024(it->second);
}
}
@@ -1317,7 +1316,7 @@ cmExportBuildFileGenerator* cmGlobalGenerator::GetExportedTargetsFile(
const std::string& filename) const
{
auto const it = this->BuildExportSets.find(filename);
- return it == this->BuildExportSets.end() ? nullptr : it->second.get();
+ return it == this->BuildExportSets.end() ? nullptr : it->second;
}
void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
@@ -1353,9 +1352,9 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
void cmGlobalGenerator::ComputeBuildFileGenerators()
{
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
- std::vector<cmExportBuildFileGenerator*> gens =
+ std::vector<std::unique_ptr<cmExportBuildFileGenerator>> const& gens =
this->Makefiles[i]->GetExportBuildFileGenerators();
- for (cmExportBuildFileGenerator* g : gens) {
+ for (std::unique_ptr<cmExportBuildFileGenerator> const& g : gens) {
g->Compute(this->LocalGenerators[i].get());
}
}