(At least for the repeatable test case that Tim produced.)
pattern_subx(): Add missing DECREF(filter) in both exit branches
(normal and error return). Also fix a DECREF(args) that should
certainly be a DECREF(match) -- because it's inside if (!args) and
right after allocation of match.
goto error;
args = Py_BuildValue("(O)", match);
if (!args) {
- Py_DECREF(args);
+ Py_DECREF(match);
goto error;
}
item = PyObject_CallObject(filter, args);
state_fini(&state);
+ Py_DECREF(filter);
+
/* convert list to single string (also removes list) */
item = join(list, self->pattern);
return item;
error:
+ Py_DECREF(filter);
Py_DECREF(list);
state_fini(&state);
return NULL;