From: Maxim Mamontov Date: Wed, 31 Aug 2011 10:02:51 +0000 (+0300) Subject: Fix resource leak in file_store X-Git-Tag: 2.408-alpha~16 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/ff837095e9e509d3e03ace33fe1010eef35ebd02 Fix resource leak in file_store --- diff --git a/projects/stargazer/plugins/store/files/file_store.cpp b/projects/stargazer/plugins/store/files/file_store.cpp index 6d8de6c2..890b2b6c 100644 --- a/projects/stargazer/plugins/store/files/file_store.cpp +++ b/projects/stargazer/plugins/store/files/file_store.cpp @@ -532,6 +532,7 @@ while ((entry = readdir(d))) errorStr += strerror(errno); errorStr += "'"; printfd(__FILE__, "FILES_STORE::RemoveDir() - unlink failed. Message: '%s'\n", strerror(errno)); + closedir(d); return -1; } } @@ -540,6 +541,7 @@ while ((entry = readdir(d))) { if (RemoveDir(str.c_str())) { + closedir(d); return -1; }