[PATCH v2 2/4] Free the data returned by XGetWindowProperty()

Eirik Byrkjeflot Anonsen eirik at eirikba.org
Thu May 21 05:55:32 PDT 2015


Signed-off-by: Eirik Byrkjeflot Anonsen <eirik at eirikba.org>
---
 xprop.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xprop.c b/xprop.c
index ba23b87..4576db6 100644
--- a/xprop.c
+++ b/xprop.c
@@ -1442,9 +1442,15 @@ Get_Window_Property_Data_And_Type (Atom atom,
     unsigned long nitems;
     unsigned long nbytes;
     unsigned long bytes_after;
-    unsigned char *prop;
+    static unsigned char *prop = NULL;
     int status;
-	
+
+    if (prop)
+    {
+	XFree(prop);
+	prop = NULL;
+    }
+
     status = XGetWindowProperty(dpy, target_win, atom, 0, (max_len+3)/4,
 				False, AnyPropertyType, &actual_type,
 				&actual_format, &nitems, &bytes_after,
-- 
2.1.4



More information about the xorg-devel mailing list