mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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:
parent
fc4514c22b
commit
152fbe88e9
1 changed files with 3 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue