From 6b8161972d44447bf5f604c226cadcd0b3b68ccc Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 21 Jan 2021 16:28:20 +1100 Subject: [PATCH] [host] nvfbc: prevent possible double free --- host/platform/Windows/capture/NVFBC/src/nvfbc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index ad9a0658..2958f0f3 100644 --- a/host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -210,8 +210,18 @@ static bool nvfbc_init(void) static void nvfbc_stop(void) { this->stop = true; - lgSignalEvent(this->cursorEvents[0]); - lgSignalEvent(this->frameEvent); + + if (this->cursorEvents[0]) + { + lgSignalEvent(this->cursorEvents[0]); + this->cursorEvents[0] = NULL; + } + + if (this->frameEvent) + { + lgSignalEvent(this->frameEvent); + this->frameEvent = NULL; + } if (this->pointerThread) {