mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
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:
parent
3ebe04ee8e
commit
91c05f9403
4
xutil.c
4
xutil.c
@ -73,8 +73,10 @@ xu_get_strprop(Window win, Atom atm, char **text) {
|
|||||||
*text = NULL;
|
*text = NULL;
|
||||||
|
|
||||||
XGetTextProperty(X_Dpy, win, &prop, atm);
|
XGetTextProperty(X_Dpy, win, &prop, atm);
|
||||||
if (!prop.nitems)
|
if (!prop.nitems) {
|
||||||
|
XFree(prop.value);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (Xutf8TextPropertyToTextList(X_Dpy, &prop, &list,
|
if (Xutf8TextPropertyToTextList(X_Dpy, &prop, &list,
|
||||||
&nitems) == Success && nitems > 0 && *list) {
|
&nitems) == Success && nitems > 0 && *list) {
|
||||||
|
Loading…
Reference in New Issue
Block a user