diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-01-26 07:43:34 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-02-02 12:07:03 (GMT) |
commit | 31492cc049a8dfe7f52748922a88f117499d62a3 (patch) | |
tree | 7f3c16a39b673676abf158bfffce7af825e0836c | |
parent | bb84c5ef4f620af659395b66e6ed792a380b9a1f (diff) | |
download | Qt-31492cc049a8dfe7f52748922a88f117499d62a3.zip Qt-31492cc049a8dfe7f52748922a88f117499d62a3.tar.gz Qt-31492cc049a8dfe7f52748922a88f117499d62a3.tar.bz2 |
Fixes memory leaks in QX11Embed
We should XFree the values returned from XGetWindowProperty.
Task-number: QTBUG-16597
Reviewed-by: Ritt Konstantin
-rw-r--r-- | src/gui/kernel/qx11embed_x11.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index aba42f2..710f607 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -415,8 +415,9 @@ static Bool functor(Display *display, XEvent *event, XPointer arg) status = XGetWindowProperty(display, data->id, ATOM(WM_STATE), 0, 2, False, ATOM(WM_STATE), &ret, &format, &nitems, &after, &retval ); if (status == Success && ret == ATOM(WM_STATE) && format == 32 && nitems > 0) { - long *state = (long *)retval; - if (state[0] == WithdrawnState) { + long state = *(long *)retval; + XFree(retval); + if (state == WithdrawnState) { data->clearedWmState = true; return true; } @@ -833,6 +834,8 @@ bool QX11EmbedWidget::x11Event(XEvent *event) XUnmapWindow(x11Info().display(), internalWinId()); } } + if (prop_return) + XFree(prop_return); } } |