From fcb8aef0c1a06be6170162e81275d2ade4d0d866 Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Tue, 5 Oct 2021 10:21:40 +0200 Subject: Fix leak on getDefaultScreeenId XRRMonitorInfo struct is supposed to be cleaned-up after getMonitors with a separate call to freeMonitors. Change-Id: Iacc296d1f5e434a1d52798fe09d57833660b7952 Reviewed-by: Michal Klocek (cherry picked from commit b868f2893b3ba2fb02d9c7212de7e01b3f9e498a) Reviewed-by: Qt Cherry-pick Bot --- src/core/media_capture_devices_dispatcher.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/core/media_capture_devices_dispatcher.cpp') diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 2661c2bba..c9256f8ac 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -194,6 +194,7 @@ content::DesktopMediaID getDefaultScreenId() int numMonitors = 0; XRRMonitorInfo *monitors = getMonitors(display, rootWindow, true, &numMonitors); + auto cleanup = qScopeGuard([&] () { freeMonitors(monitors); }); if (numMonitors > 0) return content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN, monitors[0].name); #endif // !defined(WEBRTC_USE_X11) -- cgit v1.2.3