Skip to content

Commit 310125e

Browse files
[3.13] gh-151112: Fix double free in assemble_init when out of memory (GH-151142) (#151207)
gh-151112: Fix double free in `assemble_init` when out of memory (GH-151142) (cherry picked from commit 5804991) Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 7d530aa commit 310125e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a crash in the compiler that could occur when running out of memory.

Python/assemble.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ assemble_init(struct assembler *a, int firstlineno)
8080
}
8181
return SUCCESS;
8282
error:
83-
Py_XDECREF(a->a_bytecode);
84-
Py_XDECREF(a->a_linetable);
85-
Py_XDECREF(a->a_except_table);
83+
Py_CLEAR(a->a_bytecode);
84+
Py_CLEAR(a->a_linetable);
85+
Py_CLEAR(a->a_except_table);
8686
return ERROR;
8787
}
8888

0 commit comments

Comments
 (0)