Fix XRemoteClient leaks. Bug 295173, patch by Ferdinand

<ferdinandw+bmo@gmail.com>, r=caillon
This commit is contained in:
bzbarsky%mit.edu 2005-08-19 15:15:34 +00:00
parent 2273edc3a7
commit 7d705097f5

View File

@ -262,8 +262,10 @@ XRemoteClient::CheckWindow(Window aWindow)
0, 0, False, AnyPropertyType,
&type, &format, &nitems, &bytesafter, &data);
if (type)
if (type) {
XFree(data);
return aWindow;
}
// didn't find it here so check the children of this window
innerWindow = CheckChildren(aWindow);
@ -297,9 +299,11 @@ XRemoteClient::CheckChildren(Window aWindow)
XGetWindowProperty(mDisplay, children[i], mMozWMStateAtom,
0, 0, False, AnyPropertyType, &type, &format,
&nitems, &after, &data);
if (type)
if (type) {
XFree(data);
retval = children[i];
}
}
// otherwise recurse into the list
for (i=0; !retval && (i < nchildren); i++) {
@ -582,6 +586,9 @@ XRemoteClient::FindBestWindow(const char *aProgram, const char *aUsername,
bestWindow = w;
}
if (kids)
XFree((char *) kids);
return bestWindow;
}