From 33f905df885041e97a465c3706046fa4378ea27f 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/qxcbatom.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/plugins/platforms/xcb/qxcbatom.cpp b/src/plugins/platforms/xcb/qxcbatom.cpp
index a769ddad..a33b1b44 100644
--- a/src/plugins/platforms/xcb/qxcbatom.cpp
+++ b/src/plugins/platforms/xcb/qxcbatom.cpp
@@ -270,8 +270,10 @@ void QXcbAtom::initializeAllAtoms(xcb_connection_t *connection) {
 
     for (i = 0; i < QXcbAtom::NAtoms; ++i) {
         xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookies[i], nullptr);
-        m_allAtoms[i] = reply->atom;
-        free(reply);
+        if (reply) {
+            m_allAtoms[i] = reply->atom;
+            free(reply);
+        }        
     }
 }
 
-- 
2.27.0

