You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Fix file handle leak in ZipArchive and FileAccessZip
This commit is contained in:
@@ -174,7 +174,6 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint6
|
|||||||
|
|
||||||
Package pkg;
|
Package pkg;
|
||||||
pkg.filename = p_path;
|
pkg.filename = p_path;
|
||||||
pkg.zfile = zfile;
|
|
||||||
packages.push_back(pkg);
|
packages.push_back(pkg);
|
||||||
int pkg_num = packages.size() - 1;
|
int pkg_num = packages.size() - 1;
|
||||||
|
|
||||||
@@ -201,6 +200,8 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unzClose(zfile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,10 +226,6 @@ ZipArchive::ZipArchive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZipArchive::~ZipArchive() {
|
ZipArchive::~ZipArchive() {
|
||||||
for (int i = 0; i < packages.size(); i++) {
|
|
||||||
unzClose(packages[i].zfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
packages.clear();
|
packages.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
struct Package {
|
struct Package {
|
||||||
String filename;
|
String filename;
|
||||||
unzFile zfile = nullptr;
|
|
||||||
};
|
};
|
||||||
Vector<Package> packages;
|
Vector<Package> packages;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user