aboutsummaryrefslogtreecommitdiff
path: root/src/unittest
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2016-07-28 08:56:22 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2016-08-10 16:59:32 +0200
commit48b3bb980d4a026d32739acc1982f16e3c303c5b (patch)
tree1685d44bb69642771a9840171bcab93a68f6da49 /src/unittest
parent1be3894e6f283b0538a725bc438922c7d7ec294a (diff)
downloadminetest-48b3bb980d4a026d32739acc1982f16e3c303c5b.tar.gz
minetest-48b3bb980d4a026d32739acc1982f16e3c303c5b.tar.bz2
minetest-48b3bb980d4a026d32739acc1982f16e3c303c5b.zip
couple of memory leaks fixes.
Diffstat (limited to 'src/unittest')
-rw-r--r--src/unittest/test_map_settings_manager.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/unittest/test_map_settings_manager.cpp b/src/unittest/test_map_settings_manager.cpp
index 9292bf87c..4f5ac80f2 100644
--- a/src/unittest/test_map_settings_manager.cpp
+++ b/src/unittest/test_map_settings_manager.cpp
@@ -75,8 +75,10 @@ std::string read_file_to_string(const std::string &filepath)
fseek(f, 0, SEEK_END);
long filesize = ftell(f);
- if (filesize == -1)
+ if (filesize == -1) {
+ fclose(f);
return "";
+ }
rewind(f);
buf.resize(filesize);