xcb: Fix minor leaks in XSettings code
If some of the X11 requests fail, QXcbXSettings::QXcbXSettings() prints a warning and returns. These error paths all caused memory leaks. Change-Id: Idfecf03dd412c35552c3bbbebdda9c039aeadc13 Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
parent
4acff670c5
commit
ec2aa7d282
@ -221,6 +221,7 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen)
|
||||
xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,&error);
|
||||
if (error) {
|
||||
qWarning() << Q_FUNC_INFO << "Failed to find XSETTINGS_S atom";
|
||||
free(error);
|
||||
return;
|
||||
}
|
||||
xcb_atom_t selection_owner_atom = atom_reply->atom;
|
||||
@ -233,14 +234,15 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen)
|
||||
xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, &error);
|
||||
if (error) {
|
||||
qWarning() << Q_FUNC_INFO << "Failed to get selection owner for XSETTINGS_S atom";
|
||||
free(error);
|
||||
return;
|
||||
}
|
||||
|
||||
d_ptr->x_settings_window = selection_result->owner;
|
||||
free(selection_result);
|
||||
if (!d_ptr->x_settings_window) {
|
||||
return;
|
||||
}
|
||||
free(selection_result);
|
||||
|
||||
const uint32_t event = XCB_CW_EVENT_MASK;
|
||||
const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE };
|
||||
|
Loading…
Reference in New Issue
Block a user