summary refs log tree commit diff
diff options
context:
space:
mode:
authortobias <tobias>2020-04-25 20:07:28 +0000
committertobias <tobias>2020-04-25 20:07:28 +0000
commit91c05f94032debb645c14c76c9911ea5cfba5d3c (patch)
tree1ce37c00eca9a95ef6f4013228dbd2c4dd73442d
parent3ebe04ee8ea2e5362678a102f6b1a4b418613f20 (diff)
downloadcwm-91c05f94032debb645c14c76c9911ea5cfba5d3c.tar.gz
cwm-91c05f94032debb645c14c76c9911ea5cfba5d3c.tar.xz
cwm-91c05f94032debb645c14c76c9911ea5cfba5d3c.zip
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@
-rw-r--r--xutil.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xutil.c b/xutil.c
index 37af7db..230a2c5 100644
--- a/xutil.c
+++ b/xutil.c
@@ -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) {