summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-02 11:54:20 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-02 12:10:55 (GMT)
commit17ee918b2cd2bb012a538b721bbd888677072614 (patch)
tree414e97c83311c022965ce6c11ea7c77ca8c66e82 /src/gui
parent31492cc049a8dfe7f52748922a88f117499d62a3 (diff)
downloadQt-17ee918b2cd2bb012a538b721bbd888677072614.zip
Qt-17ee918b2cd2bb012a538b721bbd888677072614.tar.gz
Qt-17ee918b2cd2bb012a538b721bbd888677072614.tar.bz2
Carefull free the data from XGetWindowProperty on X11.
Make sure we free the data correctly in case of error. Task-number: QTBUG-16616 Patch-by: Juuso Pakarinen Reviewed-by: Ritt Konstantin
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qwidget_x11.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 9893478..28eb3f0 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -444,6 +444,7 @@ static QVector<Atom> getNetWmState(QWidget *w)
&& actualType == XA_ATOM && actualFormat == 32) {
returnValue.resize(bytesLeft / 4);
XFree((char*) propertyData);
+ propertyData = 0;
// fetch all data
if (XGetWindowProperty(X11->display, w->internalWinId(), ATOM(_NET_WM_STATE), 0,
@@ -458,7 +459,8 @@ static QVector<Atom> getNetWmState(QWidget *w)
if (!returnValue.isEmpty()) {
memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom));
}
- XFree((char*) propertyData);
+ if (propertyData)
+ XFree((char*) propertyData);
}
return returnValue;