From 71a0a66deb80dc52590280b3aa470b970862db93 Mon Sep 17 00:00:00 2001
From: Alex Schmidt <alex@treefish.org>
Date: Tue, 13 Aug 2013 09:54:18 +0200
Subject: [PATCH] forgot to close dir.

---
 writeout.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/writeout.cpp b/writeout.cpp
index 03423c5..af67fb5 100644
--- a/writeout.cpp
+++ b/writeout.cpp
@@ -130,6 +130,7 @@ string writeout::getdatfile(string subname)
 
   if((dp  = opendir(fulldir.c_str())) == NULL) {
     logf << "Error(" << errno << ") opening " << fulldir << endl;
+    closedir(dp);
     return "";
   }
   
@@ -139,9 +140,11 @@ string writeout::getdatfile(string subname)
 
       if(myfile.length() > 3 && myfile.substr(myfile.length()-4) == "part" &&
 	 subname == myfile.substr( myfile.find("-")+1, myfile.rfind(".")-myfile.find("-")-1 ) ) {
+	closedir(dp);
 	return myfile;
       }
     }
 
+  closedir(dp);
   return "";
 }
-- 
2.39.5