Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f5cba6

Browse files
author
Fredrik Lundh
committed
fixed a memory leak in pattern cleanup (patch #103248 by cgw)
1 parent 47adcba commit 6f5cba6

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Modules/_sre.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
* 2000-10-24 fl really fixed assert_not; reset groups in findall
2525
* 2000-12-21 fl fixed memory leak in groupdict
2626
* 2001-01-02 fl properly reset pointer after failed assertion in MIN_UNTIL
27-
* 2001-01-15 fl don't use recursion for unbounded MIN_UTIL
27+
* 2001-01-15 fl don't use recursion for unbounded MIN_UTIL; fixed
28+
* 2001-01-16 fl fixed memory leak in pattern destructor
2829
*
2930
* Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
3031
*
@@ -1234,8 +1235,10 @@ _compile(PyObject* self_, PyObject* args)
12341235

12351236
Py_DECREF(code);
12361237

1237-
if (PyErr_Occurred())
1238+
if (PyErr_Occurred()) {
1239+
PyObject_DEL(self);
12381240
return NULL;
1241+
}
12391242

12401243
Py_INCREF(pattern);
12411244
self->pattern = pattern;
@@ -1532,6 +1535,7 @@ pattern_dealloc(PatternObject* self)
15321535
{
15331536
Py_XDECREF(self->pattern);
15341537
Py_XDECREF(self->groupindex);
1538+
Py_XDECREF(self->indexgroup);
15351539
PyObject_DEL(self);
15361540
}
15371541

0 commit comments

Comments
 (0)