From: Barry Warsaw <barry@python.org>
Date: Thu, 16 Aug 2001 20:33:48 +0000 (+0000)
Subject: init_sre(): Plug a little leak reported by Insure.
X-Git-Tag: v2.2a3~492
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=214a0b138291a649b90f86ae7d3b2a788016947d;p=python

init_sre(): Plug a little leak reported by Insure.
---

diff --git a/Modules/_sre.c b/Modules/_sre.c
index caf47aab29..1776a16aaa 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);
 
 }