[xembedsniproxy] Fix memleak and possible crash

Authored by wbauer on Jun 17 2017, 5:03 PM.



Check the return value of xcb_get_window_attributes_reply() to prevent a crash if getting the window attributes would fail for some reason.

Also free the returned structure after usage to avoid memleaks.
This is necessary according to https://xcb.freedesktop.org/windowcontextandmanipulation (see the end of the page).

Test Plan

We got some reports about XEmbed icons not showing up any more in openSUSE after the previous fixes (not reproducible though).
And this is the only place that could cause a crash IMHO.

I actually was able to reproduce a crash after installing an old fcitx version (that caused xembedsniproxy to crash before), this patch fixes the crash.

Diff Detail

R120 Plasma Workspace
Lint Skipped
Unit Tests Skipped
wbauer created this revision.Jun 17 2017, 5:03 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJun 17 2017, 5:03 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
This revision is now accepted and ready to land.Jun 17 2017, 5:11 PM
wbauer closed this revision.Jun 17 2017, 5:34 PM

Submitted to branch Plasma/5.10 with https://cgit.kde.org/plasma-workspace.git/commit/?id=a17de5957d4ba0f07c77fa99860c9046ff8aa1be
(somehow this didn't get auto-closed)