Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ _PyCode_New(struct _PyCodeConstructor *con)
}

if (init_code(co, con) < 0) {
Py_XDECREF(replacement_locations);
Py_DECREF(co);
return NULL;
}
Expand Down Expand Up @@ -2451,13 +2452,15 @@ code_dealloc(PyObject *self)
#ifdef Py_GIL_DISABLED
// The first element always points to the mutable bytecode at the end of
// the code object, which will be freed when the code object is freed.
for (Py_ssize_t i = 1; i < co->co_tlbc->size; i++) {
char *entry = co->co_tlbc->entries[i];
if (entry != NULL) {
PyMem_Free(entry);
if (co->co_tlbc != NULL) {
for (Py_ssize_t i = 1; i < co->co_tlbc->size; i++) {
char *entry = co->co_tlbc->entries[i];
if (entry != NULL) {
PyMem_Free(entry);
}
}
PyMem_Free(co->co_tlbc);
}
PyMem_Free(co->co_tlbc);
#endif
PyObject_Free(co);
}
Expand Down
Loading