diff options
author | Marc Mutz <marc.mutz@qt.io> | 2024-03-27 12:04:23 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2024-04-18 10:31:01 +0100 |
commit | 1cfe42235c4496f68195385507dbaa553d04aee5 (patch) | |
tree | 84d5e2a57e3e94369a2ec5dad9461284cf26e9da /src/plugins/platforms | |
parent | d2436f72946950376c6e4aeea1e138f147efd1ad (diff) |
QEglFSKmsGbmScreen::framebufferForBufferObject: release() at the correct time
It's the gbm_bo_get_user_data() function that takes ownership of the
FrameBuffer object, not the caller of the function, so release() into
gbm_bo_set_user_data() not into the return. This threw Coverity off,
which complained about a leak of the return value in the caller.
Amends 2f0fa59d5903d4c9596ed42dcbaa9da0f77c78da, but not picking
through all the refactorings the code has since seen.
Pick-to: 6.7 6.6 6.5
Coverity-Id: 444117
Change-Id: I5f058e4a42942349193eecfd8c00ec9499ef4886
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index 073ba3bdcc..8dcfed04db 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -73,8 +73,9 @@ QEglFSKmsGbmScreen::FrameBuffer *QEglFSKmsGbmScreen::framebufferForBufferObject( return nullptr; } - gbm_bo_set_user_data(bo, fb.get(), bufferDestroyedHandler); - return fb.release(); + auto res = fb.get(); + gbm_bo_set_user_data(bo, fb.release(), bufferDestroyedHandler); + return res; } QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QEglFSKmsDevice *device, const QKmsOutput &output, bool headless) |