[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 580499177c)

Co-authored-by: Stan Ulbrych <stan@python.org>
This commit is contained in:
Miss Islington (bot) 2026-06-09 22:13:45 +02:00 committed by GitHub
parent ea7d943efd
commit 24cb16ee80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -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;
}