aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-11-24 01:45:40 -0800
committerGitHub <noreply@github.com>2022-11-24 01:45:40 -0800
commit4255a9fbc30bba44645182d19ebd51eb9a2e16a5 (patch)
tree3be875b031dfecb0ce123d6243e45fafb4a0a87d
parentUse faster APIs to calculate paths at startup for Store packaged Python on Wi... (diff)
downloadcpython-4255a9fbc30bba44645182d19ebd51eb9a2e16a5.tar.gz
cpython-4255a9fbc30bba44645182d19ebd51eb9a2e16a5.tar.bz2
cpython-4255a9fbc30bba44645182d19ebd51eb9a2e16a5.zip
gh-98872: Fix a possible resource leak in Python 3.11.0 (GH-99047)
Issue: GH-98872 (cherry picked from commit 4e5f2db6f228d45a655cf22fd587792d56116145) Co-authored-by: SQLPATCH <95843853+SQLPATCH@users.noreply.github.com> Automerge-Triggered-By: GH:kumaraditya303
-rw-r--r--Misc/NEWS.d/next/Build/2022-11-03-08-10-49.gh-issue-98872.gdsR8X.rst1
-rw-r--r--Programs/_freeze_module.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Build/2022-11-03-08-10-49.gh-issue-98872.gdsR8X.rst b/Misc/NEWS.d/next/Build/2022-11-03-08-10-49.gh-issue-98872.gdsR8X.rst
new file mode 100644
index 00000000000..ad4dc496ee0
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2022-11-03-08-10-49.gh-issue-98872.gdsR8X.rst
@@ -0,0 +1 @@
+Fix a possible fd leak in ``Programs/_freeze_module.c`` introduced in Python 3.11.
diff --git a/Programs/_freeze_module.c b/Programs/_freeze_module.c
index 3d27b79c237..7c4d60a500d 100644
--- a/Programs/_freeze_module.c
+++ b/Programs/_freeze_module.c
@@ -194,6 +194,7 @@ write_frozen(const char *outpath, const char *inpath, const char *name,
if (ferror(outfile)) {
fprintf(stderr, "error when writing to '%s'\n", outpath);
+ fclose(outfile);
return -1;
}
fclose(outfile);