summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-01-14 17:37:24 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-01-14 17:37:24 (GMT)
commit0560e8a8f8e737688a377a0e934a892100fa19d0 (patch)
treedbdb85da00db2f21623eb77c6cf954da00c6fa89 /Modules
parent9000c1614d183345165271c42926da80102a2a36 (diff)
downloadcpython-0560e8a8f8e737688a377a0e934a892100fa19d0.zip
cpython-0560e8a8f8e737688a377a0e934a892100fa19d0.tar.gz
cpython-0560e8a8f8e737688a377a0e934a892100fa19d0.tar.bz2
Merged revisions 77501 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r77501 | antoine.pitrou | 2010-01-14 18:34:48 +0100 (jeu., 14 janv. 2010) | 10 lines Merged revisions 77499 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77499 | antoine.pitrou | 2010-01-14 18:25:24 +0100 (jeu., 14 janv. 2010) | 4 lines Issue #3299: Fix possible crash in the _sre module when given bad argument values in debug mode. Patch by Victor Stinner. ........ ................
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sre.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 45b92f3..74d9425 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2674,6 +2674,10 @@ _compile(PyObject* self_, PyObject* args)
self = PyObject_NEW_VAR(PatternObject, &Pattern_Type, n);
if (!self)
return NULL;
+ self->weakreflist = NULL;
+ self->pattern = NULL;
+ self->groupindex = NULL;
+ self->indexgroup = NULL;
self->codesize = n;
@@ -2689,7 +2693,7 @@ _compile(PyObject* self_, PyObject* args)
}
if (PyErr_Occurred()) {
- PyObject_DEL(self);
+ Py_DECREF(self);
return NULL;
}
@@ -3730,7 +3734,7 @@ static void
scanner_dealloc(ScannerObject* self)
{
state_fini(&self->state);
- Py_DECREF(self->pattern);
+ Py_XDECREF(self->pattern);
PyObject_DEL(self);
}
@@ -3860,10 +3864,11 @@ pattern_scanner(PatternObject* pattern, PyObject* args)
self = PyObject_NEW(ScannerObject, &Scanner_Type);
if (!self)
return NULL;
+ self->pattern = NULL;
string = state_init(&self->state, pattern, string, start, end);
if (!string) {
- PyObject_DEL(self);
+ Py_DECREF(self);
return NULL;
}