summaryrefslogtreecommitdiff
path: root/platform/javascript/export/export_server.h
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-03-23 11:08:58 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-11 13:28:51 +0300
commit9381acb6a42da653cb6dfd9e610dfccead11aa98 (patch)
tree7c781fabd1f496345ca73cc362a5f88060af0fde /platform/javascript/export/export_server.h
parentca9372622f331f26daf38086a31c4eeea768e540 (diff)
Make FileAccess and DirAccess classes reference counted.
Diffstat (limited to 'platform/javascript/export/export_server.h')
-rw-r--r--platform/javascript/export/export_server.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/platform/javascript/export/export_server.h b/platform/javascript/export/export_server.h
index 1b908ad9b0..f77ac3d1ad 100644
--- a/platform/javascript/export/export_server.h
+++ b/platform/javascript/export/export_server.h
@@ -153,8 +153,8 @@ public:
}
const String ctype = mimes[req_ext];
- FileAccess *f = FileAccess::open(filepath, FileAccess::READ);
- ERR_FAIL_COND(!f);
+ Ref<FileAccess> f = FileAccess::open(filepath, FileAccess::READ);
+ ERR_FAIL_COND(f.is_null());
String s = "HTTP/1.1 200 OK\r\n";
s += "Connection: Close\r\n";
s += "Content-Type: " + ctype + "\r\n";
@@ -166,7 +166,6 @@ public:
CharString cs = s.utf8();
Error err = peer->put_data((const uint8_t *)cs.get_data(), cs.size() - 1);
if (err != OK) {
- memdelete(f);
ERR_FAIL();
}
@@ -178,11 +177,9 @@ public:
}
err = peer->put_data(bytes, read);
if (err != OK) {
- memdelete(f);
ERR_FAIL();
}
}
- memdelete(f);
}
void poll() {