diff --git a/janus/src/plugin.c b/janus/src/plugin.c index d7fd7f1..5c9da7a 100644 --- a/janus/src/plugin.c +++ b/janus/src/plugin.c @@ -166,11 +166,9 @@ static void *_video_sink_thread(UNUSED void *arg) { if (mem != NULL) { US_JLOG_INFO("video", "Memsink closed"); us_memsink_shared_unmap(mem); - mem = NULL; } - if (fd > 0) { + if (fd >= 0) { close(fd); - fd = -1; } sleep(1); // error_delay } diff --git a/python/src/ustreamer.c b/python/src/ustreamer.c index 4786555..ee312bb 100644 --- a/python/src/ustreamer.c +++ b/python/src/ustreamer.c @@ -44,7 +44,7 @@ static void _MemsinkObject_destroy_internals(_MemsinkObject *self) { us_memsink_shared_unmap(self->mem); self->mem = NULL; } - if (self->fd > 0) { + if (self->fd >= 0) { close(self->fd); self->fd = -1; }