Skip to content

Commit 5541d96

Browse files
committed
fix: Should free xcb_query_pointer_reply return pointer
1 parent 394cbef commit 5541d96

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/common/utility_x11.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,18 @@ void Utility::sendMoveResizeMessage(quint32 WId, uint32_t action, QPoint globalP
178178
if (globalPos.isNull()) {
179179
//QTBUG-76114
180180
//globalPos = QCursor::pos();
181+
xcb_generic_error_t** err = nullptr;
181182
xcb_query_pointer_reply_t* p = xcb_query_pointer_reply(QX11Info::connection(),
182183
xcb_query_pointer(QX11Info::connection(),
183184
QX11Info::appRootWindow(QX11Info::appScreen())),
184-
nullptr);
185-
globalPos = QPoint(p->root_x, p->root_y);
185+
err);
186+
if (p && err == nullptr) {
187+
globalPos = QPoint(p->root_x, p->root_y);
188+
}
189+
190+
if (p) {
191+
free(p);
192+
}
186193
}
187194

188195
xcb_client_message_event_t xev;

0 commit comments

Comments
 (0)