File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -744,6 +744,7 @@ _PyCode_New(struct _PyCodeConstructor *con)
744744 }
745745
746746 if (init_code (co , con ) < 0 ) {
747+ Py_XDECREF (replacement_locations );
747748 Py_DECREF (co );
748749 return NULL ;
749750 }
@@ -2451,13 +2452,15 @@ code_dealloc(PyObject *self)
24512452#ifdef Py_GIL_DISABLED
24522453 // The first element always points to the mutable bytecode at the end of
24532454 // the code object, which will be freed when the code object is freed.
2454- for (Py_ssize_t i = 1 ; i < co -> co_tlbc -> size ; i ++ ) {
2455- char * entry = co -> co_tlbc -> entries [i ];
2456- if (entry != NULL ) {
2457- PyMem_Free (entry );
2455+ if (co -> co_tlbc != NULL ) {
2456+ for (Py_ssize_t i = 1 ; i < co -> co_tlbc -> size ; i ++ ) {
2457+ char * entry = co -> co_tlbc -> entries [i ];
2458+ if (entry != NULL ) {
2459+ PyMem_Free (entry );
2460+ }
24582461 }
2462+ PyMem_Free (co -> co_tlbc );
24592463 }
2460- PyMem_Free (co -> co_tlbc );
24612464#endif
24622465 PyObject_Free (co );
24632466}
You can’t perform that action at this time.
0 commit comments