diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-10-05 10:21:40 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-10-06 06:21:19 +0000 |
commit | fcb8aef0c1a06be6170162e81275d2ade4d0d866 (patch) | |
tree | 7dd548457a6bc7ad90f3035c14764fbc6ca7a961 /src/core/media_capture_devices_dispatcher.cpp | |
parent | 53bdbb973a4d5f226e9ba01897d0bd6aef61842e (diff) |
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 <michal.klocek@qt.io>
(cherry picked from commit b868f2893b3ba2fb02d9c7212de7e01b3f9e498a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/core/media_capture_devices_dispatcher.cpp')
-rw-r--r-- | src/core/media_capture_devices_dispatcher.cpp | 1 |
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) |