summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-03-07 23:53:32 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-03-07 23:53:32 (GMT)
commitdf44ab7b1cfb97b29712f40db422f27b2d8d1838 (patch)
tree0c564fe1d04c4d95733766167aa3ab603b06ab2f /Modules
parent516999e6e2b1d89bc29a8930d651e4cddf968bfe (diff)
downloadcpython-df44ab7b1cfb97b29712f40db422f27b2d8d1838.zip
cpython-df44ab7b1cfb97b29712f40db422f27b2d8d1838.tar.gz
cpython-df44ab7b1cfb97b29712f40db422f27b2d8d1838.tar.bz2
_hotshot hotshot_profiler(): If write_header() returned
an error code, this let `self` leak. This is a disaster on Windows, since `self` already points to a newly-opened file object, and it was impossible for Python code to close the thing since the only reference to it was in a blob of leaked C memory. test_hotshot test_bad_sys_path(): This new test provoked the C bug above. This test passed, but left an open "@test" file behind, which caused a massive cascade of bogus test failures in later, unrelated tests on Windows. Changed the test code to remove the @test file it leaves behind, which relies on the change above to close that file first.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_hotshot.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c
index 64dfa91..d5b4cde 100644
--- a/Modules/_hotshot.c
+++ b/Modules/_hotshot.c
@@ -1525,9 +1525,11 @@ hotshot_profiler(PyObject *unused, PyObject *args)
calibrate();
calibrate();
}
- if (write_header(self))
+ if (write_header(self)) {
/* some error occurred, exception has been set */
+ Py_DECREF(self);
self = NULL;
+ }
}
return (PyObject *) self;
}