summaryrefslogtreecommitdiffstats
path: root/Modules/regexmodule.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1997-01-09 22:22:05 (GMT)
committerBarry Warsaw <barry@python.org>1997-01-09 22:22:05 (GMT)
commit4bc9d3956059fd8ba6e41e8550336dc6de60bb02 (patch)
tree49357906a5f371ffd6b570dbcd64babf1a3ebe35 /Modules/regexmodule.c
parent4b76ba3280634886356782c0ecc66ac08895826a (diff)
downloadcpython-4bc9d3956059fd8ba6e41e8550336dc6de60bb02.zip
cpython-4bc9d3956059fd8ba6e41e8550336dc6de60bb02.tar.gz
cpython-4bc9d3956059fd8ba6e41e8550336dc6de60bb02.tar.bz2
Nailed a couple of memory leaks, caught by Purify.
Diffstat (limited to 'Modules/regexmodule.c')
-rw-r--r--Modules/regexmodule.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/regexmodule.c b/Modules/regexmodule.c
index 981a6e9..695c2d2 100644
--- a/Modules/regexmodule.c
+++ b/Modules/regexmodule.c
@@ -518,6 +518,8 @@ symcomp(pattern, gdict)
Py_XDECREF(npattern);
return NULL;
}
+ Py_DECREF(group_name);
+ Py_DECREF(group_index);
++o; /* eat the '>' */
break;
}
@@ -573,6 +575,7 @@ regex_symcomp(self, args)
PyObject *tran = NULL;
PyObject *gdict = NULL;
PyObject *npattern;
+ PyObject *retval = NULL;
if (!PyArg_ParseTuple(args, "S|S", &pattern, &tran))
return NULL;
@@ -583,7 +586,9 @@ regex_symcomp(self, args)
Py_DECREF(pattern);
return NULL;
}
- return newregexobject(npattern, tran, pattern, gdict);
+ retval = newregexobject(npattern, tran, pattern, gdict);
+ Py_DECREF(npattern);
+ return retval;
}