summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2023-07-31 05:35:11 +0200
committerLiang Qi <liang.qi@qt.io>2023-07-31 13:40:27 +0200
commit552e3b9b78c136aebedf0a591af04661f0dedbbf (patch)
treeb35fd2b604f54d05c4c2f88dbd505a8963e62f9f /src/plugins/platforms/xcb
parentcdae120f7f23fefcb4adbc34c6f082c60faa2952 (diff)
xcb: guard a pointer before usage
in QXcbAtom::initializeAllAtoms(). See also the example in https://manpages.debian.org/testing/libxcb-doc/xcb_intern_atom_reply.3.en.html Fixes: QTBUG-115599 Pick-to: 6.6 6.5 6.2 Change-Id: I6590fe1aa11deec7fef7ce6d8f5c49a71d636648 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbatom.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbatom.cpp b/src/plugins/platforms/xcb/qxcbatom.cpp
index 09b1fe8a9d..a456c19490 100644
--- a/src/plugins/platforms/xcb/qxcbatom.cpp
+++ b/src/plugins/platforms/xcb/qxcbatom.cpp
@@ -230,8 +230,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);
+ }
}
}