Jelajahi Sumber

Fix file() command descriptor leak on error

Credit goes to "cppcheck".

Signed-off-by: Thomas Jarosch <[email protected]>
Thomas Jarosch 14 tahun lalu
induk
melakukan
4868921bc2
1 mengubah file dengan 2 tambahan dan 0 penghapusan
  1. 2 0
      Source/cmFileCommand.cxx

+ 2 - 0
Source/cmFileCommand.cxx

@@ -2982,6 +2982,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
     std::string errStr = "UPLOAD cannot stat file '";
     errStr += filename + "'.";
     this->SetError(errStr.c_str());
+    fclose(fin);
     return false;
     }
 
@@ -2991,6 +2992,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
   if(!curl)
     {
     this->SetError("UPLOAD error initializing curl.");
+    fclose(fin);
     return false;
     }