summaryrefslogtreecommitdiffstats
path: root/core/io/config_file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/io/config_file.cpp')
-rw-r--r--core/io/config_file.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index a01e935baa..fd20ec9404 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -127,6 +127,8 @@ Error ConfigFile::save(const String& p_path){
FileAccess *file = FileAccess::open(p_path,FileAccess::WRITE,&err);
if (err) {
+ if (file)
+ memdelete(file);
return err;
}
@@ -177,9 +179,11 @@ Error ConfigFile::load(const String& p_path) {
next_tag.fields.clear();
next_tag.name=String();
- err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL);
- if (err==ERR_FILE_EOF)
+ err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL,true);
+ if (err==ERR_FILE_EOF) {
+ memdelete(f);
return OK;
+ }
else if (err!=OK) {
ERR_PRINTS("ConfgFile::load - "+p_path+":"+itos(lines)+" error: "+error_text);
memdelete(f);