summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-08-01 16:53:42 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-08-01 16:53:42 (GMT)
commitc881f1592f9a2890e1c26ae899351e1cf8b5d622 (patch)
tree7b634333f4a51c8095b37de53d5f40aa8012e9ee /Modules
parente6c5950af0337f6d991f98d8b93b24825334e270 (diff)
downloadcpython-c881f1592f9a2890e1c26ae899351e1cf8b5d622.zip
cpython-c881f1592f9a2890e1c26ae899351e1cf8b5d622.tar.gz
cpython-c881f1592f9a2890e1c26ae899351e1cf8b5d622.tar.bz2
Issue #9448: Fix a leak of OS resources (mutexes or semaphores) when
re-initializing a buffered IO object by calling its `__init__` method.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/bufferedio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 07fe0a1..1dd1ec4 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -636,6 +636,8 @@ _buffered_init(buffered *self)
return -1;
}
#ifdef WITH_THREAD
+ if (self->lock)
+ PyThread_free_lock(self->lock);
self->lock = PyThread_allocate_lock();
if (self->lock == NULL) {
PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock");