Merge pull request #31768 from qarmin/fix_memory_leak_in_ResourceFormatSaverBinary
Fix memory leak in ResourceFormatSaverBinary::save
This commit is contained in:
commit
495a0a97a2
|
@ -1786,6 +1786,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
|
||||||
|
|
||||||
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
|
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
|
||||||
f->close();
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
return ERR_CANT_CREATE;
|
return ERR_CANT_CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1938,10 +1939,12 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
|
||||||
|
|
||||||
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
|
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
|
||||||
f->close();
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
return ERR_CANT_CREATE;
|
return ERR_CANT_CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->close();
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue