From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 9 Jun 2026 20:13:45 +0000 (+0200) Subject: [3.14] gh-151112: Fix double free in `assemble_init` when out of memory (GH-151142... X-Git-Tag: v3.14.6~3 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=24cb16ee804791295b442eefc2dd30f4926efab9;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-151112: Fix double free in `assemble_init` when out of memory (GH-151142) (#151206) gh-151112: Fix double free in `assemble_init` when out of memory (GH-151142) (cherry picked from commit 580499177ca91477b53b4a40afcec7d3370265b0) Co-authored-by: Stan Ulbrych --- diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-06-09-12-24-35.gh-issue-151112.4RKCkD.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-06-09-12-24-35.gh-issue-151112.4RKCkD.rst new file mode 100644 index 000000000000..93ee5c8cf191 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-06-09-12-24-35.gh-issue-151112.4RKCkD.rst @@ -0,0 +1 @@ +Fix a crash in the compiler that could occur when running out of memory. diff --git a/Python/assemble.c b/Python/assemble.c index 8cc2d50a3227..761ac813bf24 100644 --- a/Python/assemble.c +++ b/Python/assemble.c @@ -80,9 +80,9 @@ assemble_init(struct assembler *a, int firstlineno) } return SUCCESS; error: - Py_XDECREF(a->a_bytecode); - Py_XDECREF(a->a_linetable); - Py_XDECREF(a->a_except_table); + Py_CLEAR(a->a_bytecode); + Py_CLEAR(a->a_linetable); + Py_CLEAR(a->a_except_table); return ERROR; }