summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-08-18 05:09:50 (GMT)
committerBarry Warsaw <barry@python.org>2000-08-18 05:09:50 (GMT)
commit152fbe88e9fd661c195b2374a0d229998e18e8dc (patch)
tree669105adea026009a215e5b7158a37af7d72a5c9 /Modules/_sre.c
parentfc4514c22b0c4a84c3e2c66a12893d81492f5224 (diff)
downloadcpython-152fbe88e9fd661c195b2374a0d229998e18e8dc.zip
cpython-152fbe88e9fd661c195b2374a0d229998e18e8dc.tar.gz
cpython-152fbe88e9fd661c195b2374a0d229998e18e8dc.tar.bz2
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.
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 29e92ac..3b78fb9 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -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);