From e876e91e829f6f0d6b9942ae4de80f8323f750ca Mon Sep 17 00:00:00 2001
From: Liang Qi <liang.qi@qt.io>
Date: 2023-07-31 05:35:11 +0200
Subject: [PATCH] CVE-2023-45935

port invokeMethodImpl() from QScopeGuard to SlotObjUniquePtr

---
 src/plugins/platforms/xcb/qxcbconnection.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 5fd1fc6a..2ec668a6 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -2051,8 +2051,10 @@ void QXcbConnection::initializeAllAtoms() {
 
     for (i = 0; i < QXcbAtom::NAtoms; ++i) {
         xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0);
-        m_allAtoms[i] = reply->atom;
-        free(reply);
+         if (reply) {
+            m_allAtoms[i] = reply->atom;
+            free(reply);
+        }        
     }
 }
 
-- 
2.27.0

