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:
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user