In all four PyInit_*\ functions, the module object mis created viaPyModule_Create, then import_array()andintern_strings()are called. If either fails, the function returns NULL withoutPy_DECREF(m)`, leaking the module object.
The import_array() case is particularly tricky because the NumPy macro expands to a bare return NULL that cannot be intercepted. Using _import_array() (which returns an int error code) would allow proper cleanup.
File(s): reduce_template.c:1974-1975, move_template.c:1543-1544, nonreduce_template.c:355-356, nonreduce_axis_template.c:1035-1036
See #518 for the complete report.
Found using cext-review-toolkit.
In all four
PyInit_*\ functions, the module objectmis created viaPyModule_Create, thenimport_array()andintern_strings()are called. If either fails, the function returns NULL withoutPy_DECREF(m)`, leaking the module object.The
import_array()case is particularly tricky because the NumPy macro expands to a barereturn NULLthat cannot be intercepted. Using_import_array()(which returns an int error code) would allow proper cleanup.File(s):
reduce_template.c:1974-1975,move_template.c:1543-1544,nonreduce_template.c:355-356,nonreduce_axis_template.c:1035-1036See #518 for the complete report.
Found using cext-review-toolkit.