From 90f968de8ec152e27b617a1ddd1908959a85c6e9 Mon Sep 17 00:00:00 2001
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
Date: Thu, 1 Sep 2011 21:57:30 +0200
Subject: [PATCH 2/3] Fix file descriptor leak on error

Credit goes to "cppcheck".

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
 Source/cmFileCommand.cxx |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 9a3de9b..3b63906 100644
--- a/Source/cmFileCommand.cxx
+++ b/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;
     }
 
-- 
1.7.4.4

