From dfe61514650dfc84f8854fef50002d20cf6e8d52 Mon Sep 17 00:00:00 2001 From: Scott Cooper Date: Tue, 3 Sep 2024 12:44:18 +1000 Subject: [PATCH] win-capture: Fix segfault when calling data.free() data.free should be checked before calling. --- plugins/win-capture/graphics-hook/dxgi-capture.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/win-capture/graphics-hook/dxgi-capture.cpp b/plugins/win-capture/graphics-hook/dxgi-capture.cpp index 7892dbf63..d175aa565 100644 --- a/plugins/win-capture/graphics-hook/dxgi-capture.cpp +++ b/plugins/win-capture/graphics-hook/dxgi-capture.cpp @@ -48,7 +48,8 @@ static void STDMETHODCALLTYPE SwapChainDestructed(void *pData) dxgi_possible_swap_queue_count = 0; dxgi_present_attempted = false; - data.free(); + if (data.free) + data.free(); data.free = nullptr; } } @@ -187,7 +188,8 @@ static void update_mismatch_count(bool match) dxgi_possible_swap_queue_count = 0; dxgi_present_attempted = false; - data.free(); + if (data.free) + data.free(); data.free = nullptr; swap_chain_mismatch_count = 0;