]> granicus.if.org Git - python/commitdiff
Issue #10157: Fixed refleaks in pythonrun.c. Patch by Stefan Krah.
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Sat, 30 Oct 2010 15:08:15 +0000 (15:08 +0000)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Sat, 30 Oct 2010 15:08:15 +0000 (15:08 +0000)
Python/pythonrun.c

index 33dd11bc88595ac3ec84a667178d37f25cb2ab2b..8b1e61a1c93e48327e5b86b2bb48ec5700a5a2e8 100644 (file)
@@ -283,6 +283,7 @@ Py_InitializeEx(int install_sigs)
         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_NewInterpreter(void)
             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 @@ initstdio(void)
         if (encoding != NULL) {
             _PyCodec_Lookup(encoding);
         }
+        Py_DECREF(encoding_attr);
     }
     PyErr_Clear();  /* Not a fatal error if codec isn't available */