]> git.stg.codes - stg.git/commitdiff
Fix resource leak in file_store
authorMaxim Mamontov <faust.madf@gmail.com>
Wed, 31 Aug 2011 10:02:51 +0000 (13:02 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Wed, 31 Aug 2011 10:02:51 +0000 (13:02 +0300)
projects/stargazer/plugins/store/files/file_store.cpp

index 6d8de6c2c00b7f625a5083802bd333a9625f0424..890b2b6c107eb49c93721b9f39670cdeacfbf2be 100644 (file)
@@ -532,6 +532,7 @@ while ((entry = readdir(d)))
             errorStr += strerror(errno);
             errorStr += "'";
             printfd(__FILE__, "FILES_STORE::RemoveDir() - unlink failed. Message: '%s'\n", strerror(errno));
             errorStr += strerror(errno);
             errorStr += "'";
             printfd(__FILE__, "FILES_STORE::RemoveDir() - unlink failed. Message: '%s'\n", strerror(errno));
+            closedir(d);
             return -1;
             }
         }
             return -1;
             }
         }
@@ -540,6 +541,7 @@ while ((entry = readdir(d)))
         {
         if (RemoveDir(str.c_str()))
             {
         {
         if (RemoveDir(str.c_str()))
             {
+            closedir(d);
             return -1;
             }
 
             return -1;
             }