mirror of https://github.com/godotengine/godot
Fix file handle leak in ZipArchive and FileAccessZip
This commit is contained in:
parent
0e3dbba6a5
commit
d8b09c4757
|
|
@ -176,7 +176,6 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint6
|
|||
|
||||
Package pkg;
|
||||
pkg.filename = p_path;
|
||||
pkg.zfile = zfile;
|
||||
packages.push_back(pkg);
|
||||
int pkg_num = packages.size() - 1;
|
||||
|
||||
|
|
@ -203,6 +202,8 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint6
|
|||
}
|
||||
}
|
||||
|
||||
unzClose(zfile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -227,10 +228,6 @@ ZipArchive::ZipArchive() {
|
|||
}
|
||||
|
||||
ZipArchive::~ZipArchive() {
|
||||
for (int i = 0; i < packages.size(); i++) {
|
||||
unzClose(packages[i].zfile);
|
||||
}
|
||||
|
||||
packages.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ public:
|
|||
private:
|
||||
struct Package {
|
||||
String filename;
|
||||
unzFile zfile = nullptr;
|
||||
};
|
||||
Vector<Package> packages;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue