qt_imageToWinHBITMAP(): properly delete object on error

Properly delete the handle created by CreateDIBSection() with
DeleteObject() in case of error.

Pick-to: 6.6 6.5
Fixes: QTBUG-18057
Change-Id: Ibf40f6afb255bc5a7d7bf39939f5eb3dfcd19f84
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b37b8eb7ea0a809c6e96189e8f9e834d6763e170)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2023-12-11 19:32:09 +01:00 committed by Qt Cherry-pick Bot
parent 30e0dc908c
commit ce44d63bc3

View File

@ -305,6 +305,7 @@ HBITMAP qt_imageToWinHBITMAP(const QImage &imageIn, int hbitmapFormat)
return nullptr;
}
if (!pixels) {
DeleteObject(bitmap);
qErrnoWarning("%s, did not allocate pixel data", __FUNCTION__);
return nullptr;
}