summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
Diffstat (limited to 'core/io')
-rw-r--r--core/io/config_file.cpp6
-rw-r--r--core/io/json.cpp2
2 files changed, 6 insertions, 2 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index d79a3d1288..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;
}
@@ -178,8 +180,10 @@ Error ConfigFile::load(const String& p_path) {
next_tag.name=String();
err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL,true);
- if (err==ERR_FILE_EOF)
+ 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);
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 45a97ed720..f9a8638d06 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -86,7 +86,7 @@ String JSON::_print_var(const Variant& p_var) {
s+="}";
return s;
};
- default: return "\""+String(p_var).c_escape()+"\"";
+ default: return "\""+String(p_var).json_escape()+"\"";
}