summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2001-01-16 07:05:29 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2001-01-16 07:05:29 (GMT)
commit6f5cba68fcf75ab9e8b8986033de648e6b96b2d5 (patch)
tree9a22e406bedce33a60887b4f68bbf487adb65506 /Modules/_sre.c
parent47adcbafc07b833918948092093e1d6e7e1cfe13 (diff)
downloadcpython-6f5cba68fcf75ab9e8b8986033de648e6b96b2d5.zip
cpython-6f5cba68fcf75ab9e8b8986033de648e6b96b2d5.tar.gz
cpython-6f5cba68fcf75ab9e8b8986033de648e6b96b2d5.tar.bz2
fixed a memory leak in pattern cleanup (patch #103248 by cgw)
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index efb704b..f308dac 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -24,7 +24,8 @@
* 2000-10-24 fl really fixed assert_not; reset groups in findall
* 2000-12-21 fl fixed memory leak in groupdict
* 2001-01-02 fl properly reset pointer after failed assertion in MIN_UNTIL
- * 2001-01-15 fl don't use recursion for unbounded MIN_UTIL
+ * 2001-01-15 fl don't use recursion for unbounded MIN_UTIL; fixed
+ * 2001-01-16 fl fixed memory leak in pattern destructor
*
* Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
*
@@ -1234,8 +1235,10 @@ _compile(PyObject* self_, PyObject* args)
Py_DECREF(code);
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
+ PyObject_DEL(self);
return NULL;
+ }
Py_INCREF(pattern);
self->pattern = pattern;
@@ -1532,6 +1535,7 @@ pattern_dealloc(PatternObject* self)
{
Py_XDECREF(self->pattern);
Py_XDECREF(self->groupindex);
+ Py_XDECREF(self->indexgroup);
PyObject_DEL(self);
}