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

Skip to content

Commit 214a0b1

Browse files
committed
init_sre(): Plug a little leak reported by Insure.
1 parent 5aa3c4a commit 214a0b1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Modules/_sre.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,6 +2616,7 @@ init_sre(void)
26162616
{
26172617
PyObject* m;
26182618
PyObject* d;
2619+
PyObject* x;
26192620

26202621
/* Patch object types */
26212622
Pattern_Type.ob_type = Match_Type.ob_type =
@@ -2625,12 +2626,14 @@ init_sre(void)
26252626
d = PyModule_GetDict(m);
26262627

26272628
PyDict_SetItemString(
2628-
d, "MAGIC", (PyObject*) PyInt_FromLong(SRE_MAGIC)
2629+
d, "MAGIC", (x = (PyObject*) PyInt_FromLong(SRE_MAGIC))
26292630
);
2631+
Py_XDECREF(x);
26302632

26312633
PyDict_SetItemString(
2632-
d, "copyright", (PyObject*) PyString_FromString(copyright)
2634+
d, "copyright", (x = (PyObject*)PyString_FromString(copyright))
26332635
);
2636+
Py_XDECREF(x);
26342637

26352638
}
26362639

0 commit comments

Comments
 (0)