]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98872: Fix a possible resource leak in Python 3.11.0 (GH-99047)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 24 Nov 2022 09:45:40 +0000 (01:45 -0800)
committerGitHub <noreply@github.com>
Thu, 24 Nov 2022 09:45:40 +0000 (01:45 -0800)
Issue: GH-98872
(cherry picked from commit 4e5f2db6f228d45a655cf22fd587792d56116145)

Co-authored-by: SQLPATCH <95843853+SQLPATCH@users.noreply.github.com>
Automerge-Triggered-By: GH:kumaraditya303
Misc/NEWS.d/next/Build/2022-11-03-08-10-49.gh-issue-98872.gdsR8X.rst [new file with mode: 0644]
Programs/_freeze_module.c

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 (file)
index 0000000..ad4dc49
--- /dev/null
@@ -0,0 +1 @@
+Fix a possible fd leak in ``Programs/_freeze_module.c`` introduced in Python 3.11.
index 3d27b79c237c364b8647bdf3c9611b57c8bcaaa8..7c4d60a500d638ef3f12d1faabe173924cbd2dc9 100644 (file)
@@ -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);