]> granicus.if.org Git - python/commitdiff
init_sre(): Plug a little leak reported by Insure.
authorBarry Warsaw <barry@python.org>
Thu, 16 Aug 2001 20:33:48 +0000 (20:33 +0000)
committerBarry Warsaw <barry@python.org>
Thu, 16 Aug 2001 20:33:48 +0000 (20:33 +0000)
Modules/_sre.c

index caf47aab29a3ae6e71b6ae5a5183724242ab7f53..1776a16aaacfcf45b730b41391946f71dcb0c928 100644 (file)
@@ -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);
 
 }