1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

couple of memory leaks fixes.

This commit is contained in:
David Carlier 2016-07-28 08:56:22 +01:00 committed by Loic Blot
parent 1be3894e6f
commit 48b3bb980d
5 changed files with 23 additions and 3 deletions

View file

@ -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);