From 214a0b138291a649b90f86ae7d3b2a788016947d Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Thu, 16 Aug 2001 20:33:48 +0000 Subject: [PATCH] init_sre(): Plug a little leak reported by Insure. --- Modules/_sre.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/_sre.c b/Modules/_sre.c index caf47aab29a..1776a16aaac 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2616,6 +2616,7 @@ init_sre(void) { PyObject* m; PyObject* d; + PyObject* x; /* Patch object types */ Pattern_Type.ob_type = Match_Type.ob_type = @@ -2625,12 +2626,14 @@ init_sre(void) d = PyModule_GetDict(m); PyDict_SetItemString( - d, "MAGIC", (PyObject*) PyInt_FromLong(SRE_MAGIC) + d, "MAGIC", (x = (PyObject*) PyInt_FromLong(SRE_MAGIC)) ); + Py_XDECREF(x); PyDict_SetItemString( - d, "copyright", (PyObject*) PyString_FromString(copyright) + d, "copyright", (x = (PyObject*)PyString_FromString(copyright)) ); + Py_XDECREF(x); }