]> granicus.if.org Git - python/commitdiff
Fix Bug #125891 - os.popen2,3 and 4 leaked file objects on Windows.
authorMark Hammond <mhammond@skippinet.com.au>
Wed, 31 Jan 2001 05:38:47 +0000 (05:38 +0000)
committerMark Hammond <mhammond@skippinet.com.au>
Wed, 31 Jan 2001 05:38:47 +0000 (05:38 +0000)
Modules/posixmodule.c

index 99e5864b2c7dafc117816de04be6ce813cdc8f0a..9f44edc49c82bd3c413a5536fe85c7e380f78f65 100644 (file)
@@ -2518,6 +2518,8 @@ _PyPopen(char *cmdstring, int mode, int n)
                         CloseHandle(hChildStderrRdDup);
 
                 f = Py_BuildValue("OO",p1,p2);
+                Py_XDECREF(p1);
+                Py_XDECREF(p2);
                 file_count = 2;
                 break;
         }
@@ -2548,6 +2550,9 @@ _PyPopen(char *cmdstring, int mode, int n)
                 PyFile_SetBufSize(p2, 0);
                 PyFile_SetBufSize(p3, 0);
                 f = Py_BuildValue("OOO",p1,p2,p3);
+                Py_XDECREF(p1);
+                Py_XDECREF(p2);
+                Py_XDECREF(p3);
                 file_count = 3;
                 break;
         }