pattern_findall(): Plug small memory leak discovered by Insure.

PyList_Append() always incref's the inserted item.  Be sure to decref
it regardless of whether the append succeeds or fails.
This commit is contained in:
Barry Warsaw 2000-08-18 05:09:50 +00:00
parent fc4514c22b
commit 152fbe88e9

View file

@ -1698,10 +1698,10 @@ pattern_findall(PatternObject* self, PyObject* args)
break;
}
if (PyList_Append(list, item) < 0) {
Py_DECREF(item);
status = PyList_Append(list, item);
Py_DECREF(item);
if (status < 0)
goto error;
}
if (state.ptr == state.start)
state.start = (void*) ((char*) state.ptr + state.charsize);