diff options
author | Uli Schlachter <psychon@znc.in> | 2013-07-19 15:27:16 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-25 11:25:42 +0200 |
commit | ec2aa7d282e007dcf62c79a7098286bdd9a6e1f5 (patch) | |
tree | e6cda8dfadd5884036e0b1ebf39e31cd47271b5b /src/plugins/platforms/xcb/qxcbxsettings.cpp | |
parent | 4acff670c522501417aa5159a8aea42b1ae962bb (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbxsettings.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbxsettings.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index c106bd00f8..1423c6262d 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -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 }; |