diff Python/pythonrun.c @ 65762:ea14977a36de

Issue #10157: Fixed refleaks in pythonrun.c. Patch by Stefan Krah.
author Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
date Sat, 30 Oct 2010 15:08:15 +0000
parents 6ac18576e8fa
children 06f76ef27f86
line wrap: on
line diff
--- a/Python/pythonrun.c	Sat Oct 30 14:33:28 2010 +0000
+++ b/Python/pythonrun.c	Sat Oct 30 15:08:15 2010 +0000
@@ -283,6 +283,7 @@
         Py_FatalError("Py_Initialize: can't set preliminary stderr");
     PySys_SetObject("stderr", pstderr);
     PySys_SetObject("__stderr__", pstderr);
+    Py_DECREF(pstderr);
 
     _PyImport_Init();
 
@@ -605,6 +606,7 @@
             Py_FatalError("Py_Initialize: can't set preliminary stderr");
         PySys_SetObject("stderr", pstderr);
         PySys_SetObject("__stderr__", pstderr);
+        Py_DECREF(pstderr);
 
         _PyImportHooks_Init();
         if (initstdio() < 0)
@@ -971,6 +973,7 @@
         if (encoding != NULL) {
             _PyCodec_Lookup(encoding);
         }
+        Py_DECREF(encoding_attr);
     }
     PyErr_Clear();  /* Not a fatal error if codec isn't available */