Fix memory leak after closing files
(cherry picked from commit 53c0a29fb0
)
This commit is contained in:
parent
1804a726b4
commit
cb394082ef
|
@ -726,6 +726,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt
|
||||||
|
|
||||||
image_data = cached_data;
|
image_data = cached_data;
|
||||||
file->close();
|
file->close();
|
||||||
|
memdelete(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -800,6 +801,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
|
||||||
if (file) {
|
if (file) {
|
||||||
file->store_line(new_etag);
|
file->store_line(new_etag);
|
||||||
file->close();
|
file->close();
|
||||||
|
memdelete(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = p_data.size();
|
int len = p_data.size();
|
||||||
|
@ -809,6 +811,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
|
||||||
file->store_32(len);
|
file->store_32(len);
|
||||||
file->store_buffer(r.ptr(), len);
|
file->store_buffer(r.ptr(), len);
|
||||||
file->close();
|
file->close();
|
||||||
|
memdelete(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -848,6 +851,7 @@ void EditorAssetLibrary::_update_image_queue() {
|
||||||
if (file) {
|
if (file) {
|
||||||
headers.push_back("If-None-Match: " + file->get_line());
|
headers.push_back("If-None-Match: " + file->get_line());
|
||||||
file->close();
|
file->close();
|
||||||
|
memdelete(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,6 @@ void AppxPackager::make_block_map() {
|
||||||
|
|
||||||
tmp_file->close();
|
tmp_file->close();
|
||||||
memdelete(tmp_file);
|
memdelete(tmp_file);
|
||||||
tmp_file = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String AppxPackager::content_type(String p_extension) {
|
String AppxPackager::content_type(String p_extension) {
|
||||||
|
@ -291,7 +290,6 @@ void AppxPackager::make_content_types() {
|
||||||
|
|
||||||
tmp_file->close();
|
tmp_file->close();
|
||||||
memdelete(tmp_file);
|
memdelete(tmp_file);
|
||||||
tmp_file = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<uint8_t> AppxPackager::make_file_header(FileMeta p_file_meta) {
|
Vector<uint8_t> AppxPackager::make_file_header(FileMeta p_file_meta) {
|
||||||
|
@ -602,7 +600,6 @@ void AppxPackager::finish() {
|
||||||
|
|
||||||
blockmap_file->close();
|
blockmap_file->close();
|
||||||
memdelete(blockmap_file);
|
memdelete(blockmap_file);
|
||||||
blockmap_file = NULL;
|
|
||||||
|
|
||||||
// Add content types
|
// Add content types
|
||||||
EditorNode::progress_task_step("export", "Setting content types...", 5);
|
EditorNode::progress_task_step("export", "Setting content types...", 5);
|
||||||
|
@ -618,7 +615,6 @@ void AppxPackager::finish() {
|
||||||
|
|
||||||
types_file->close();
|
types_file->close();
|
||||||
memdelete(types_file);
|
memdelete(types_file);
|
||||||
types_file = NULL;
|
|
||||||
|
|
||||||
// Pre-process central directory before signing
|
// Pre-process central directory before signing
|
||||||
for (int i = 0; i < file_metadata.size(); i++) {
|
for (int i = 0; i < file_metadata.size(); i++) {
|
||||||
|
|
Loading…
Reference in New Issue