changeset 100155:69913c2322d0

(Fx_get_cut_buffer_internal): Fix memory leak.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 03 Dec 2008 04:34:06 +0000
parents 234ea6739ae8
children a2ea34e75036
files src/xselect.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xselect.c	Wed Dec 03 04:33:44 2008 +0000
+++ b/src/xselect.c	Wed Dec 03 04:34:06 2008 +0000
@@ -2392,9 +2392,16 @@
 
   x_get_window_property (display, window, buffer_atom, &data, &bytes,
 			 &type, &format, &size, 0);
-  if (!data || !format)
+
+  if (!data)
     return Qnil;
 
+  if (!format)
+    {
+      xfree (data);
+      return Qnil;
+    }
+
   if (format != 8 || type != XA_STRING)
     signal_error ("Cut buffer doesn't contain 8-bit data",
 		  list2 (x_atom_to_symbol (display, type),