diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-11-23 11:48:16 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-11-23 12:41:42 +0100 |
commit | 9b3729d63cbed7c343f6c68983a40d9fbf329958 (patch) | |
tree | 324016d3a5084e21c0fd6e7cff05859dd2ace635 | |
parent | 2925425f02c7730343da48dbbf6501b907a21b6b (diff) |
Avoid memory leak on PostMessageW failure
In addition to leaking memory, the struct holds a couple of VclPtr,
so would prevent destroying referenced windows.
Change-Id: I258b5f32aca033a602d7b2805b33bd08ba637309
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143154
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | vcl/win/window/salframe.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 42c9a802c232..ad54e4f20dbb 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -1045,8 +1045,10 @@ void WinSalFrame::ReleaseGraphics( SalGraphics* pGraphics ) bool WinSalFrame::PostEvent(std::unique_ptr<ImplSVEvent> pData) { - bool const ret = PostMessageW(mhWnd, SAL_MSG_USEREVENT, 0, reinterpret_cast<LPARAM>(pData.release())); + bool const ret = PostMessageW(mhWnd, SAL_MSG_USEREVENT, 0, reinterpret_cast<LPARAM>(pData.get())); SAL_WARN_IF(!ret, "vcl", "ERROR: PostMessage() failed!"); + if (ret) + pData.release(); return ret; } |