summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-22 18:30:22 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-22 18:30:22 +0300
commit1ee6d71c1d771ab8a990ef427a59f54132910ac7 (patch)
tree39c63dab7d76356a588ea2202427b29d50e1e7dd
parent7f72738f54abef2ec0ae080b58bbfde1c3c02c36 (diff)
downloadmanaverse-1ee6d71c1d771ab8a990ef427a59f54132910ac7.tar.gz
manaverse-1ee6d71c1d771ab8a990ef427a59f54132910ac7.tar.bz2
manaverse-1ee6d71c1d771ab8a990ef427a59f54132910ac7.tar.xz
manaverse-1ee6d71c1d771ab8a990ef427a59f54132910ac7.zip
Add some cppcheck fixes.
-rw-r--r--src/input/touch/touchmanager.cpp1
-rw-r--r--src/utils/files.cpp14
2 files changed, 9 insertions, 6 deletions
diff --git a/src/input/touch/touchmanager.cpp b/src/input/touch/touchmanager.cpp
index be6dd072d..28929db19 100644
--- a/src/input/touch/touchmanager.cpp
+++ b/src/input/touch/touchmanager.cpp
@@ -86,6 +86,7 @@ void TouchManager::shutdown() restrict2
void TouchManager::init() restrict2
{
+ delete mVertexes;
mVertexes = new ImageCollection;
config.addListener("showScreenJoystick", this);
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index 463031493..6f7ae3147 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -355,14 +355,16 @@ void Files::deleteFilesInDirectory(std::string path)
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());
- while ((next_file = readdir(dir)))
- {
- const std::string file = next_file->d_name;
- if (file != "." && file != "..")
- remove((path + file).c_str());
- }
if (dir)
+ {
+ while ((next_file = readdir(dir)))
+ {
+ const std::string file = next_file->d_name;
+ if (file != "." && file != "..")
+ remove((path + file).c_str());
+ }
closedir(dir);
+ }
}
void Files::getFilesInDir(const std::string &dir,