Commit 152fbe88 authored by Barry Warsaw's avatar Barry Warsaw

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.
parent fc4514c2
...@@ -1698,10 +1698,10 @@ pattern_findall(PatternObject* self, PyObject* args) ...@@ -1698,10 +1698,10 @@ pattern_findall(PatternObject* self, PyObject* args)
break; break;
} }
if (PyList_Append(list, item) < 0) { status = PyList_Append(list, item);
Py_DECREF(item); Py_DECREF(item);
if (status < 0)
goto error; goto error;
}
if (state.ptr == state.start) if (state.ptr == state.start)
state.start = (void*) ((char*) state.ptr + state.charsize); state.start = (void*) ((char*) state.ptr + state.charsize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment