summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2021-10-05 10:21:40 +0200
committerKirill Burtsev <kirill.burtsev@qt.io>2021-10-05 12:28:48 +0200
commitb868f2893b3ba2fb02d9c7212de7e01b3f9e498a (patch)
tree99a7eacc09a6fcef30bab4994811562356a4f949
parentcd7a7db3557c120d82abdf50532b73087e344fa3 (diff)
Fix leak on getDefaultScreeenId
XRRMonitorInfo struct is supposed to be cleaned-up after getMonitors with a separate call to freeMonitors. Pick-to: 6.2 5.15 Change-Id: Iacc296d1f5e434a1d52798fe09d57833660b7952 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--src/core/media_capture_devices_dispatcher.cpp1
1 files changed, 1 insertions, 0 deletions
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)