diff --git a/os/streams.c b/os/streams.c index 3748ec2d5..47c338267 100644 --- a/os/streams.c +++ b/os/streams.c @@ -616,8 +616,10 @@ static Int cont_stream_property(USES_REGS1) { /* current_stream */ } else { while (GLOBAL_Stream[i].status & Free_Stream_f) { ++i; - if (i == MaxStreams) - cut_fail(); + if (i == MaxStreams) { + UNLOCK(GLOBAL_StreamDescLock); + cut_fail(); + } } LOCK(GLOBAL_Stream[i].streamlock); UNLOCK(GLOBAL_StreamDescLock);