Fixed memory leak in xu_get_strprop.

If a client calls XSetTextProperty for a window to clear all its
properties, then allocated memory within libX11 is not freed.

OK okan@
This commit is contained in:
tobias 2020-04-25 20:07:28 +00:00
parent 3ebe04ee8e
commit 91c05f9403
1 changed files with 3 additions and 1 deletions

View File

@ -73,8 +73,10 @@ xu_get_strprop(Window win, Atom atm, char **text) {
*text = NULL;
XGetTextProperty(X_Dpy, win, &prop, atm);
if (!prop.nitems)
if (!prop.nitems) {
XFree(prop.value);
return 0;
}
if (Xutf8TextPropertyToTextList(X_Dpy, &prop, &list,
&nitems) == Success && nitems > 0 && *list) {