diff options
author | Brad King <brad.king@kitware.com> | 2019-08-22 14:51:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-08-26 13:43:36 (GMT) |
commit | a8ca5aea946e1154b4518ba28db3f4e695dbf165 (patch) | |
tree | cc774f8ecb2dc810afd3246ca17b427dd36841bf /Source/cmMakefileTargetGenerator.cxx | |
parent | a7aade84198343af9de79fda5c37560a2f9531a4 (diff) | |
download | CMake-a8ca5aea946e1154b4518ba28db3f4e695dbf165.zip CMake-a8ca5aea946e1154b4518ba28db3f4e695dbf165.tar.gz CMake-a8ca5aea946e1154b4518ba28db3f4e695dbf165.tar.bz2 |
cmMakefileTargetGenerator: Check for null before using a pointer
Fix the order of logic added by commit 7740ccd1a4 (ENH: some cleanup of
the makefile generator, 2006-02-14, v2.4.0~517) to check for allocation
failure ('new' returns null) before using the pointer.
Issue: #19610
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f35df32..0f13540 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -131,10 +131,10 @@ void cmMakefileTargetGenerator::CreateRuleFile() this->BuildFileStream = new cmGeneratedFileStream(this->BuildFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); - this->BuildFileStream->SetCopyIfDifferent(true); if (!this->BuildFileStream) { return; } + this->BuildFileStream->SetCopyIfDifferent(true); this->LocalGenerator->WriteDisclaimer(*this->BuildFileStream); if (this->GlobalGenerator->AllowDeleteOnError()) { std::vector<std::string> no_depends; @@ -300,10 +300,10 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() this->FlagFileStream = new cmGeneratedFileStream(this->FlagFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); - this->FlagFileStream->SetCopyIfDifferent(true); if (!this->FlagFileStream) { return; } + this->FlagFileStream->SetCopyIfDifferent(true); this->LocalGenerator->WriteDisclaimer(*this->FlagFileStream); // Include the flags for the target. @@ -1033,10 +1033,10 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() this->InfoFileNameFull = this->LocalGenerator->ConvertToFullPath(this->InfoFileNameFull); this->InfoFileStream = new cmGeneratedFileStream(this->InfoFileNameFull); - this->InfoFileStream->SetCopyIfDifferent(true); - if (!*this->InfoFileStream) { + if (!this->InfoFileStream) { return; } + this->InfoFileStream->SetCopyIfDifferent(true); this->LocalGenerator->WriteDependLanguageInfo(*this->InfoFileStream, this->GeneratorTarget); |